Interface: WebSocketClientOptions
Defined in: packages/client/src/links/wsLink/wsClient/options.ts:4
Extends​
UrlOptionsWithConnectionParams
Properties​
connectionParams?​
optionalconnectionParams:CallbackOrValue<null|Dict<string>>
Defined in: packages/client/src/links/internals/urlWithConnectionParams.ts:32
Connection params that are available in createContext()
- For
wsLink/wsClient, these are sent as the first message - For
httpSubscriptionLink, these are serialized as part of the URL under theconnectionParamsquery
Inherited from​
UrlOptionsWithConnectionParams.connectionParams
experimental_encoder?​
optionalexperimental_encoder:Encoder
Defined in: packages/client/src/links/wsLink/wsClient/options.ts:64
Custom encoder for wire encoding (e.g. custom binary formats)
Default​
tsjsonEncoder
tsjsonEncoder
keepAlive?​
optionalkeepAlive:object
Defined in: packages/client/src/links/wsLink/wsClient/options.ts:44
Send ping messages to the server and kill the connection if no pong message is returned
enabled​
enabled:
boolean
Default​
tsfalse
tsfalse
intervalMs?​
optionalintervalMs:number
Send a ping message every this many milliseconds
Default​
ts5_000
ts5_000
pongTimeoutMs?​
optionalpongTimeoutMs:number
Close the WebSocket after this many milliseconds if the server does not respond
Default​
ts1_000
ts1_000
lazy?​
optionallazy:object
Defined in: packages/client/src/links/wsLink/wsClient/options.ts:29
Lazy mode will close the WebSocket automatically after a period of inactivity (no messages sent or received and no pending requests)
closeMs​
closeMs:
number
Close the WebSocket after this many milliseconds
Default​
ts0
ts0
enabled​
enabled:
boolean
Enable lazy mode
Default​
tsfalse
tsfalse
onClose()?​
optionalonClose: (cause?) =>void
Defined in: packages/client/src/links/wsLink/wsClient/options.ts:25
Triggered when a WebSocket connection is closed
Parameters​
| Parameter | Type |
|---|---|
cause? | { code: number; } |
cause.code? | number |
Returns​
void
onError()?​
optionalonError: (evt?) =>void
Defined in: packages/client/src/links/wsLink/wsClient/options.ts:21
Triggered when a WebSocket connection encounters an error
Parameters​
| Parameter | Type |
|---|---|
evt? | Event |
Returns​
void
onOpen()?​
optionalonOpen: () =>void
Defined in: packages/client/src/links/wsLink/wsClient/options.ts:17
Triggered when a WebSocket connection is established
Returns​
void
retryDelayMs()?​
optionalretryDelayMs: (attemptIndex) =>number
Defined in: packages/client/src/links/wsLink/wsClient/options.ts:13
The number of milliseconds before a reconnect is attempted.
Parameters​
| Parameter | Type |
|---|---|
attemptIndex | number |
Returns​
number
Default​
exponentialBackoff
url​
url:
CallbackOrValue<string>
Defined in: packages/client/src/links/internals/urlWithConnectionParams.ts:25
The URL to connect to (can be a function that returns a URL)
Inherited from​
UrlOptionsWithConnectionParams.url
WebSocket()?​
optionalWebSocket: (url,protocols?) =>WebSocket
Defined in: packages/client/src/links/wsLink/wsClient/options.ts:8
Ponyfill which WebSocket implementation to use
Parameters​
| Parameter | Type |
|---|---|
url | string | URL |
protocols? | string | string[] |
Returns​
WebSocket
CLOSED​
readonlyCLOSED:3
CLOSING​
readonlyCLOSING:2
CONNECTING​
readonlyCONNECTING:0
OPEN​
readonlyOPEN:1
prototype​
prototype:
WebSocket