Interface: WebSocketClientOptions
Extends
UrlOptionsWithConnectionParams
Properties
connectionParams?
optional
connectionParams:CallbackOrValue
<null
|Dict
<string
>>
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 theconnectionParams
query
Inherited from
UrlOptionsWithConnectionParams.connectionParams
Defined in
packages/client/dist/links/internals/urlWithConnectionParams.d.ts:21
keepAlive?
optional
keepAlive:object
Send ping messages to the server and kill the connection if no pong message is returned
enabled
enabled:
boolean
Default
ts
false
ts
false
intervalMs?
optional
intervalMs:number
Send a ping message every this many milliseconds
Default
ts
5_000
ts
5_000
pongTimeoutMs?
optional
pongTimeoutMs:number
Close the WebSocket after this many milliseconds if the server does not respond
Default
ts
1_000
ts
1_000
Defined in
packages/client/dist/links/wsLink.d.ts:53
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)
closeMs
closeMs:
number
Close the WebSocket after this many milliseconds
Default
ts
0
ts
0
enabled
enabled:
boolean
Enable lazy mode
Default
ts
false
ts
false
Defined in
packages/client/dist/links/wsLink.d.ts:38
onClose()?
optional
onClose: (cause
?) =>void
Triggered when a WebSocket connection is closed
Parameters
Parameter | Type |
---|---|
cause ? | object |
cause.code ? | number |
Returns
void
Defined in
packages/client/dist/links/wsLink.d.ts:32
onError()?
optional
onError: (evt
?) =>void
Triggered when a WebSocket connection encounters an error
Parameters
Parameter | Type |
---|---|
evt ? | Event |
Returns
void
Defined in
packages/client/dist/links/wsLink.d.ts:28
onOpen()?
optional
onOpen: () =>void
Triggered when a WebSocket connection is established
Returns
void
Defined in
packages/client/dist/links/wsLink.d.ts:24
retryDelayMs()?
optional
retryDelayMs: (attemptIndex
) =>number
The number of milliseconds before a reconnect is attempted.
Parameters
Parameter | Type |
---|---|
attemptIndex | number |
Returns
number
Default
exponentialBackoff
Defined in
packages/client/dist/links/wsLink.d.ts:20
url
url:
CallbackOrValue
<string
>
The URL to connect to (can be a function that returns a URL)
Inherited from
UrlOptionsWithConnectionParams.url
Defined in
packages/client/dist/links/internals/urlWithConnectionParams.d.ts:15
WebSocket()?
optional
WebSocket: (url
,protocols
?) =>WebSocket
Ponyfill which WebSocket implementation to use
Parameters
Parameter | Type |
---|---|
url | string | URL |
protocols ? | string | string [] |
Returns
WebSocket
CLOSED
readonly
CLOSED:3
CLOSING
readonly
CLOSING:2
CONNECTING
readonly
CONNECTING:0
OPEN
readonly
OPEN:1
prototype
prototype:
WebSocket
Defined in
packages/client/dist/links/wsLink.d.ts:15