Full signaling socket URL including any auth/room query parameters.
Reconnect, timeout, logging, token-refresh, and queue configuration.
Closes the connection permanently, clears the queue, and cancels any pending reconnect.
Opens the connection, resolving when the socket is open and rejecting on failure/timeout.
Synchronously invokes every listener registered for event, in registration order.
The event name to emit.
The argument tuple to pass to each listener, matching Events[event].
true if at least one listener was invoked, false if there were none.
The listener list is snapshotted before dispatch, so mutations made by handlers take effect only on subsequent emissions. Listeners are isolated: if one throws, the remaining listeners still run and the error is surfaced via console.error rather than swallowed silently (consistent with LocalMessageBus).
Flushes any queued messages to the open socket. Called after (re)join to drain the offline buffer.
Returns the number of listeners currently registered for event.
The event name to count listeners for.
The count of registered listeners (0 if none).
Removes a previously registered listener for event.
The event name the listener was registered for.
This emitter, for chaining.
Registers a listener that is invoked every time event is emitted.
The event name to listen for.
Callback invoked with the event's argument tuple.
This emitter, for chaining.
Registers a listener that is invoked at most once: it is removed automatically before
being called the first time event is emitted.
The event name to listen for.
Callback invoked with the event's argument tuple on the next emission.
This emitter, for chaining.
Remove a pending one-time listener by passing the same function reference to off.
Removes listeners for a single event, or for all events.
Optionalevent: keyof TransportEventsThe event name to clear; if omitted, listeners for every event are removed.
This emitter, for chaining.
Sends a message immediately if connected, otherwise buffers it in the send queue.
Default WebSocket-based Transport.
Remarks
Handles the full connection lifecycle: it resolves a
WebSocketimplementation (the global one in browsers/Node ≥ 22, falling back to thewspackage), validates every inbound frame againstServerMessageSchemaand silently drops invalid ones, and answers serverpingframes withpongautomatically. Messages sent while the socket is not open are buffered in a MessageQueue and flushed on reconnect. When TransportOptions.reconnect is enabled it retries using a BackoffStrategy, optionally refreshing the auth token via TransportOptions.tokenRefresh before each attempt, and gives up once the strategy is exhausted.Example