Synclets logoSynclets

createWsClientTransport

The createWsClientTransport function wraps a WebSocket in a WsClientTransport implementation.

createWsClientTransport<WebSocketType>(options: WsClientTransportOptions<WebSocketType>): WsClientTransport<WebSocketType>
TypeDescription
optionsWsClientTransportOptions<WebSocketType>

WsClientTransportOptions for configuring the transport.

returnsWsClientTransport<WebSocketType>

A WsClientTransport instance for WebSocket communication.

This transport enables real-time synchronization over network connections, allowing Synclets to communicate across different machines, processes, or browser tabs. It handles automatic reconnection, packet fragmentation for large payloads, and bidirectional communication.

The client transport can only connect to servers created with a 'server' synclet running WsBrokerTransport or similar. It is suitable for browser environments (using the Web API WebSocket) and Node.js (using the 'ws' package).

Since

v0.0.0