Interface: WebSocketClientOptions
Defined in: packages/client/dist/wsLink.d-CwxAK-4Z.d.mts:36
Extendsโ
UrlOptionsWithConnectionParams
Propertiesโ
connectionParams?โ
optionalconnectionParams:CallbackOrValue<null|Dict<string>>
Defined in: packages/client/dist/wsLink.d-CwxAK-4Z.d.mts:31
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/dist/wsLink.d-CwxAK-4Z.d.mts:98
Custom encoder for wire encoding (e.g. custom binary formats)
Defaultโ
tsjsonEncoder
tsjsonEncoder
keepAlive?โ
optionalkeepAlive:object
Defined in: packages/client/dist/wsLink.d-CwxAK-4Z.d.mts:78
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/dist/wsLink.d-CwxAK-4Z.d.mts:63
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/dist/wsLink.d-CwxAK-4Z.d.mts:57
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/dist/wsLink.d-CwxAK-4Z.d.mts:53
Triggered when a WebSocket connection encounters an error
Parametersโ
| Parameter | Type |
|---|---|
evt? | Event |
Returnsโ
void
onOpen()?โ
optionalonOpen: () =>void
Defined in: packages/client/dist/wsLink.d-CwxAK-4Z.d.mts:49
Triggered when a WebSocket connection is established
Returnsโ
void
retryDelayMs()?โ
optionalretryDelayMs: (attemptIndex) =>number
Defined in: packages/client/dist/wsLink.d-CwxAK-4Z.d.mts:45
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/dist/wsLink.d-CwxAK-4Z.d.mts: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/dist/wsLink.d-CwxAK-4Z.d.mts:40
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