Interface: WebSocketClientOptions
Defined in: packages/client/dist/wsLink.d-Bssh2HIQ.d.mts:30
Extends
UrlOptionsWithConnectionParams
Properties
connectionParams?
optionalconnectionParams:CallbackOrValue<null|Dict<string>>
Defined in: packages/client/dist/wsLink.d-Bssh2HIQ.d.mts:25
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
keepAlive?
optionalkeepAlive:object
Defined in: packages/client/dist/wsLink.d-Bssh2HIQ.d.mts:72
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-Bssh2HIQ.d.mts:57
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-Bssh2HIQ.d.mts:51
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-Bssh2HIQ.d.mts:47
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-Bssh2HIQ.d.mts:43
Triggered when a WebSocket connection is established
Returns
void
retryDelayMs()?
optionalretryDelayMs: (attemptIndex) =>number
Defined in: packages/client/dist/wsLink.d-Bssh2HIQ.d.mts:39
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-Bssh2HIQ.d.mts:19
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-Bssh2HIQ.d.mts:34
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