WebSocketTransport
Defined in: websocket.ts:53
A reconnecting, buffering, JSON-framed WebSocket transport.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Implements
Section titled “Implements”Transport<T>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WebSocketTransport<T>(url, options?): WebSocketTransport<T>;Defined in: websocket.ts:74
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
url | string |
options | WebSocketTransportOptions |
Returns
Section titled “Returns”WebSocketTransport<T>
Accessors
Section titled “Accessors”connectionStatus
Section titled “connectionStatus”Get Signature
Section titled “Get Signature”get connectionStatus(): WebSocketStatus;Defined in: websocket.ts:93
Current connection state.
Returns
Section titled “Returns”Methods
Section titled “Methods”close()
Section titled “close()”close(): void;Defined in: websocket.ts:119
Permanently close this endpoint. Further sends are an error.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”connect()
Section titled “connect()”connect(): void;Defined in: websocket.ts:98
Open the socket (and re-arm auto-reconnect). Safe to call when already open.
Returns
Section titled “Returns”void
onMessage()
Section titled “onMessage()”onMessage(handler): () => void;Defined in: websocket.ts:114
Subscribe to inbound messages. Returns an unsubscribe function.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
handler | (message) => void |
Returns
Section titled “Returns”() => void
Implementation of
Section titled “Implementation of”send()
Section titled “send()”send(message): void;Defined in: websocket.ts:104
Push a message toward the peer(s) on the other side.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
message | T |
Returns
Section titled “Returns”void