ws-asyncapi API / client / WebsocketAsyncAPIOptions
Interface: WebsocketAsyncAPIOptions<Query, Headers>
Defined in: .api-entries/client/index.d.ts:40
Type Parameters
Query
Query extends Record<string, string> = Record<string, string>
Headers
Headers extends Record<string, string> = Record<string, string>
Properties
query?
optionalquery?:Query
Defined in: .api-entries/client/index.d.ts:41
headers?
optionalheaders?:Headers
Defined in: .api-entries/client/index.d.ts:46
Kept for API parity / SSR; browser WebSocket cannot set request headers, so this is ignored in the browser.
codec?
optionalcodec?:Codec
Defined in: .api-entries/client/index.d.ts:48
wire codec (default: JSON)
reconnect?
optionalreconnect?:boolean|ReconnectOptions
Defined in: .api-entries/client/index.d.ts:50
auto-reconnect with exponential backoff (default: true)
heartbeat?
optionalheartbeat?:boolean|HeartbeatOptions
Defined in: .api-entries/client/index.d.ts:52
heartbeat ping/pong liveness detection (default: true)
requestTimeout?
optionalrequestTimeout?:number
Defined in: .api-entries/client/index.d.ts:54
default RPC timeout in ms (default: 30_000)
maxBufferSize?
optionalmaxBufferSize?:number
Defined in: .api-entries/client/index.d.ts:56
max outbound frames buffered while disconnected (default: 1024)
presenceThrottle?
optionalpresenceThrottle?:number
Defined in: .api-entries/client/index.d.ts:62
Coalesce volatile presence.update calls (cursors) to the latest, flushed at most every N ms (default: 0 = send each immediately). ~50ms (~20Hz) is a good cursor default; the receiver smooths between samples.
socket?
optionalsocket?: (url) =>WebSocketLike
Defined in: .api-entries/client/index.d.ts:67
Custom transport factory (default: new WebSocket(url)). Supply one for a non-browser environment or an in-memory pipe (see @ws-asyncapi/testing).
Parameters
url
string
Returns
contractVersion?
optionalcontractVersion?:string
Defined in: .api-entries/client/index.d.ts:75
Contract version sent in the handshake. If the server's contract hash differs, the server rejects the connection (close 4409) and the client stops reconnecting and rejects opened. The CLI-generated client supplies this automatically; for the codegen-free client pass contractHash(channel) if you want runtime contract checking.