Nexus API Reference

WebSocketRoute
in package

Read onlyYes
FinalYes
Tags
psalm-api

Table of Contents

Constants

MODE_CHANNEL  : string = 'channel'
MODE_HANDLER  : string = 'handler'

Properties

$channelFactory  : Closure|null
$keyFrom  : string|null
$middleware  : array<string|int, mixed>
$mode  : string
$path  : string
$targetClass  : string

Methods

__construct()  : mixed
channel()  : self
handler()  : self

Constants

Properties

Methods

__construct()

public __construct(string $mode, string $path, class-string $targetClass, string|null $keyFrom[, callable(): WebSocketChannelActor|null $channelFactory = null ][, array<int, MiddlewareInterface|MiddlewareInterface>$middleware = [] ]) : mixed
Parameters
$mode : string
$path : string
$targetClass : class-string
$keyFrom : string|null
$channelFactory : callable(): WebSocketChannelActor|null = null

Optional custom factory for channel actors that need constructor-injected dependencies. When null, the dispatcher calls new $actorClass() (zero-arg construction).

$middleware : array<int, MiddlewareInterface|MiddlewareInterface>> = []

Per-route PSR-15 middleware run by the HandshakeGate against the upgrade request BEFORE the 101 switch (after global WS middleware).

channel()

public static channel(string $path, class-string $actorClass, string $keyFrom[, callable(): WebSocketChannelActor|null $factory = null ][, array<int, MiddlewareInterface|MiddlewareInterface>$middleware = [] ]) : self
Parameters
$path : string
$actorClass : class-string
$keyFrom : string
$factory : callable(): WebSocketChannelActor|null = null
$middleware : array<int, MiddlewareInterface|MiddlewareInterface>> = []
Return values
self

handler()

public static handler(string $path, class-string $handlerClass[, array<int, MiddlewareInterface|MiddlewareInterface>$middleware = [] ]) : self
Parameters
$path : string
$handlerClass : class-string
$middleware : array<int, MiddlewareInterface|MiddlewareInterface>> = []
Return values
self
On this page

Search results