interface WsSocketLike
Since 0.2.0

A ws socket, narrowed to what this adapter drives. Declared structurally so the package never takes a type dependency on @types/ws.

Properties

readonly
readyState: number

Numeric ready state, matching the web WebSocket API's values.

Methods

send(data: string | Uint8Array): void

Sends a text or binary frame.

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

Closes the socket.

on(
event: string,
listener: (...args: never[]) => void
): void

Subscribes to a socket event.

Usage

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