Skip to main content
Version: 11.x

Interface: WebSocketClientOptions

Properties

WebSocket

optional WebSocket: (url, protocols?) => WebSocket

Ponyfill which WebSocket implementation to use

Parameters

ParameterType
urlstring | URL
protocols?string | string[]

Returns

WebSocket

Type declaration

WebSocket.CLOSED

readonly CLOSED: 3

WebSocket.CLOSING

readonly CLOSING: 2

WebSocket.CONNECTING

readonly CONNECTING: 0

WebSocket.OPEN

readonly OPEN: 1

WebSocket.prototype

prototype: WebSocket

Source

packages/client/src/links/wsLink.ts:43


lazy

optional lazy: object

Lazy mode will close the WebSocket automatically after a period of inactivity (no messages sent or received and no pending requests)

Type declaration

lazy.closeMs

closeMs: number

Close the WebSocket after this many milliseconds

Default
ts
0;
ts
0;
lazy.enabled

enabled: boolean

Enable lazy mode

Default
ts
false;
ts
false;

Source

packages/client/src/links/wsLink.ts:60


onClose

optional onClose: (cause?) => void

Triggered when a WebSocket connection is closed

Parameters

ParameterType
cause?object
cause.code?number

Returns

void

Source

packages/client/src/links/wsLink.ts:56


onOpen

optional onOpen: () => void

Triggered when a WebSocket connection is established

Returns

void

Source

packages/client/src/links/wsLink.ts:52


retryDelayMs

optional retryDelayMs: (attemptIndex) => number

The number of milliseconds before a reconnect is attempted.

Default

ts
{@link exponentialBackoff}
ts
{@link exponentialBackoff}

Parameters

ParameterType
attemptIndexnumber

Returns

number

Source

packages/client/src/links/wsLink.ts:48


url

url: string | () => MaybePromise< string >

The URL to connect to (can be a function that returns a URL)

Source

packages/client/src/links/wsLink.ts:39


Generated using TypeDoc and typedoc-plugin-markdown