WebSocketActor
Defined in: src/io/broker/WebSocketActor.ts:56
WebSocket-client actor. Picks up the native WebSocket API on
Bun + Deno; on Node, lazy-imports the ws peer-dep. Either way
inbound text/binary frames are routed to target; outbound is the
standard enqueueOutbound path so messages buffered while
disconnected are resent after reconnect.
Server-side WebSocket upgrades (Hono/Fastify integration) are out of scope for v1 — those need access to the underlying HTTP request, which is backend-specific.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WebSocketActor(
settings?):WebSocketActor
Defined in: src/io/broker/WebSocketActor.ts:60
Parameters
Section titled “Parameters”settings?
Section titled “settings?”Partial<WebSocketActorSettings> = {}
Returns
Section titled “Returns”WebSocketActor
Overrides
Section titled “Overrides”BrokerActor<WebSocketActorSettings, WebSocketCmd, WebSocketFrame>.constructor
Methods
Section titled “Methods”onReceive()
Section titled “onReceive()”onReceive(
cmd):void
Defined in: src/io/broker/WebSocketActor.ts:132
Main message handler. Receives each envelope dequeued from the mailbox. A thrown error (sync or async) is caught by the supervisor.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Overrides
Section titled “Overrides”postRestart()
Section titled “postRestart()”postRestart(
_reason):void|Promise<void>
Defined in: src/Actor.ts:55
Called on the fresh instance after a restart. Default: call preStart().
Parameters
Section titled “Parameters”_reason
Section titled “_reason”Error
Returns
Section titled “Returns”void | Promise<void>
Inherited from
Section titled “Inherited from”postStop()
Section titled “postStop()”postStop():
Promise<void>
Defined in: src/io/broker/BrokerActor.ts:241
Called after the actor has been terminated. Children are already stopped.
Returns
Section titled “Returns”Promise<void>
Inherited from
Section titled “Inherited from”preRestart()
Section titled “preRestart()”preRestart(
_reason,_message?):void|Promise<void>
Defined in: src/Actor.ts:50
Called before a restart, on the instance about to be thrown away. The default stops children and then calls postStop().
Parameters
Section titled “Parameters”_reason
Section titled “_reason”Error
_message?
Section titled “_message?”Returns
Section titled “Returns”void | Promise<void>
Inherited from
Section titled “Inherited from”preStart()
Section titled “preStart()”preStart():
Promise<void>
Defined in: src/io/broker/BrokerActor.ts:235
Called after construction and before the first message is processed.
Returns
Section titled “Returns”Promise<void>
Inherited from
Section titled “Inherited from”supervisorStrategy()
Section titled “supervisorStrategy()”supervisorStrategy():
SupervisorStrategy
Defined in: src/Actor.ts:63
Supervisor strategy for this actor’s children. Defaults to restart, up to 10 times per minute, then stop.