A live WebSocket connection, as seen by application code.
readonly
id: string
Unique connection ID (from runtime.uuid()).
readonly
path: string
The path this connection was opened on.
readonly
readyState: WebSocketReadyState
Current lifecycle state.
readonly
isOpen: boolean
Whether the connection is still writable.
readonly
data: Map<string, unknown>
Per-connection application state, the socket-lifetime analogue of
IRequestContext.state. Use it to attach an authenticated user
id, a tenant, or any value later handlers and broadcasts need.
send(data: string | Uint8Array): void
Sends a frame to this peer.
sendJson<T>(payload: T): void
Serializes a value to JSON and sends it as a text frame.
close(code?: number,reason?: string): void
Closes the connection. Idempotent.