Appearance
Class: WebSocketTransport
Implements
Constructors
Constructor
ts
new WebSocketTransport(url, opts?): WebSocketTransport;Parameters
| Parameter | Type |
|---|---|
url | string |
opts | WebSocketTransportOptions |
Returns
WebSocketTransport
Accessors
state
Get Signature
ts
get state(): TransportState;Returns
Implementation of
Methods
close()
ts
close(code?, reason?): void;Parameters
| Parameter | Type | Default value |
|---|---|---|
code | number | 1000 |
reason | string | '' |
Returns
void
Implementation of
open()
ts
open(handlers): void;Begins connecting. handlers.onOpen or handlers.onClose will follow.
Parameters
| Parameter | Type |
|---|---|
handlers | TransportHandlers |
Returns
void
Implementation of
send()
ts
send(bytes): void;Never throws: a send on a dead socket is reported through onClose, which is the path a caller already has to handle.
Parameters
| Parameter | Type |
|---|---|
bytes | Uint8Array |
Returns
void