createWsBroker
The createWsBroker function wraps a WebSocketServer to expose the WsBroker interface.
createWsBroker(
webSocketServer: WebSocketServer,
brokerPaths?: RegExp,
): Promise<WsBroker>| Type | Description | |
|---|---|---|
webSocketServer | WebSocketServer | The WebSocketServer instance to wrap. |
brokerPaths? | RegExp | |
| returns | Promise<WsBroker> | A |
This server acts as the central connection point for multiple client Synclets to communicate with a server-side Synclet. It manages WebSocket connections, handles client authentication, and routes packets between the server Synclet and connected clients.
This function is a convenience wrapper, basically creating a Synclet with only a WsBrokerTransport and no connections. If you would like your server to also have its own connectors to store server data, you should create a Synclet yourself with those connectors and add a WsBrokerTransport to it.
The server requires the 'ws' package and is only available in Node.js environments.
Since
v0.0.0