interface WebSocketLike
Since 0.2.0

The subset of the web WebSocket API the runtime adapters drive. Declared structurally so no module depends on a platform's global types and a fake can stand in during unit tests.

Properties

readonly
readyState: number

Numeric ready state, per the web WebSocket API.

Methods

send(data: string | Uint8Array): void

Sends a text or binary frame.

close(
code?: number,
reason?: string
): void

Closes the socket.

Usage

import { type WebSocketLike } from "runtime/src/index.ts";