Core
UseWebSocketConfig
WebSocket fields of RequestOptions, plus signal.
@defjs/core · Type
Signature
type UseWebSocketConfig< TIncoming = unknown, TOutgoing = unknown, > = UseWebSocketBaseConfig<TIncoming, TOutgoing> & { signal?: AbortSignal; };
beforeConnect, heartbeat, protocols, and reconnect override the client-level options for one call. signal covers the whole session, including after it opens. There is no startup-only deadline and no abort field.
Members
Prop
Type
beforeConnect? ((context: { attempt: number; signal: AbortSignal; }) => void | Promise<void>) | undefinedheartbeat? WebSocketHeartbeatConfig<TIncoming, TOutgoing> | undefinedprotocols? readonly string[] | undefinedreconnect? { attempts?: number; delayMs?: number; factor?: number; jitter?: number; maxDelayMs?: number; shouldReconnect?: (context: { attempt: number; cause?: unknown; code?: number; reason?: string; wasClean?: boolean; }) => boolean; } | undefinedsignal? AbortSignal | undefinedAborts the session, including after it is open.