1681-engine / index / ConnectionOptions
Interface: ConnectionOptions ​
Defined in: src/net/Connection.ts:22
Properties ​
fatalCloseCodes? ​
optional fatalCloseCodes?: readonly number[];Defined in: src/net/Connection.ts:36
Close codes after which it must not reconnect (default none): the server's "kicked", "banned", "update required"… The close event then says willRetry: false.
hello? ​
optional hello?: () => unknown;Defined in: src/net/Connection.ts:29
Sent on every (re)connect as hello.data.
Returns ​
unknown
maxBackoffMs? ​
optional maxBackoffMs?: number;Defined in: src/net/Connection.ts:25
onResume? ​
optional onResume?: (cb) => () => void;Defined in: src/net/Connection.ts:44
How the probe hears of a resume (default onAppResume); returns the unsubscribe.
Parameters ​
| Parameter | Type |
|---|---|
cb | () => void |
Returns ​
() => void
pingMs? ​
optional pingMs?: number;Defined in: src/net/Connection.ts:27
Ping interval for the server clock and the round-trip time (default 1000 ms).
reconnect? ​
optional reconnect?: boolean;Defined in: src/net/Connection.ts:24
Reconnect after the socket drops (default true), waiting longer each time up to maxBackoffMs.
resumeProbeMs? ​
optional resumeProbeMs?: number;Defined in: src/net/Connection.ts:42
After the app returns from the background, ping and give the server this long to answer (default 0: off). A phone that froze the tab can come back to a socket that still says it is open and is dead; with no pong in time the socket is dropped (close code CLOSE_NO_ANSWER) and reconnected as after any drop.
WebSocket? ​
optional WebSocket?: (url, protocols?) => WebSocket;Defined in: src/net/Connection.ts:31
The WebSocket class (default the global one; Node 22+ and browsers have it).
Parameters ​
| Parameter | Type |
|---|---|
url | string | URL |
protocols? | string | string[] |
Returns ​
WebSocket