Creates a new websocket.
to connect to.
Optional
protocols: string | string[]optional protocols to use.
Optional
options: WebsocketOptionsoptional options to use.
Private
_closedPrivate
Optional
_lastPrivate
_optionsPrivate
Optional
Readonly
_protocolsPrivate
_underlyingPrivate
Readonly
_urlPrivate
Optional
retryGetter for the binaryType of the underlying websocket.
the binaryType of the underlying websocket.
Setter for the binaryType of the underlying websocket.
to set, 'blob' or 'arraybuffer'.
Getter for the buffer.
the buffer, or undefined if none was provided.
Getter for the bufferedAmount of the underlying websocket.
the bufferedAmount of the underlying websocket.
Whether the websocket was closed by the user. A websocket is closed by the user if the close().
true if the websocket was closed by the user, false otherwise.
Getter for the extensions of the underlying websocket.
the extensions of the underlying websocket.
Getter for the instantReconnect.
the instantReconnect, or undefined if none was provided.
Getter for the last 'open' event, e.g. the last time the websocket was connected.
the last 'open' event, or undefined if the websocket was never connected.
Getter for the maxRetries.
the maxRetries, or undefined if none was provided (no limit).
Getter for the protocols.
the protocols, or undefined if none were provided.
Getter for the readyState of the underlying websocket.
the readyState of the underlying websocket.
Getter for the underlying websocket. This can be used to access the browser's native websocket directly.
the underlying websocket.
Getter for the url.
the url.
Adds an event listener for the given event-type.
of the event to add the listener for.
to add.
Optional
options: WebsocketEventListenerOptionsto use when adding the listener.
Private
cancelPrivate
clearPrivate
dispatchDispatch an event to all listeners of the given event-type.
of the event to dispatch.
to dispatch.
Private
handlePrivate
handlePrivate
handleHandles the given event by dispatching it to all listeners of the given event-type.
of the event to handle.
to handle.
Private
handlePrivate
handleRemoves one or more event listener for the given event-type that match the given listener and options.
of the event to remove the listener for.
to remove.
Optional
options: WebsocketEventListenerOptionsthat were used when the listener was added.
Private
scheduleSends data over the websocket.
If the websocket is not connected and a buffer was provided on creation, the data will be added to the buffer. If no buffer was provided or the websocket was closed by the user, the data will be dropped.
to send.
Private
sendPrivate
tryGenerated using TypeDoc
A websocket wrapper that can be configured to reconnect automatically and buffer messages when the websocket is not connected.