createWsBrokerTransport
The createWsBrokerTransport function wraps a WebSocketServer in a WsBrokerTransport implementation.
createWsBrokerTransport(options: WsBrokerTransportOptions): WsBrokerTransport| Type | Description | |
|---|---|---|
options | WsBrokerTransportOptions |
|
| returns | WsBrokerTransport | A |
This transport enables a Synclet running on a server to communicate with multiple client Synclets over WebSocket connections. It handles packet fragmentation, connection management, and bidirectional communication with all connected clients.
This transport is only available in Node.js environments. It automatically broadcasts packets to all connected clients.
It is important to note that a single WsBrokerTransport instance will route messages between all WebSocket clients connected to it, regardless of the path used to connect. To isolate clients on different paths, create separate WebSocketServer instances (with noServer: true) and use the HTTP server's upgrade event handler to route connections to the appropriate WebSocketServer based on the request path.
Since
v0.0.0