interface IWebSocketTransport
Since 0.2.0

The runtime-native socket, normalized to the two operations the framework needs. Implemented by each HTTP adapter's upgrader over its platform socket (Deno.upgradeWebSocket's WebSocket, a ws socket on Node, Bun's ServerWebSocket, the server half of a Workers WebSocketPair).

Properties

readonly
readyState: WebSocketReadyState

Current lifecycle state of the underlying socket.

Methods

send(data: string | Uint8Array): void

Sends a frame to the peer. A string is sent as a text frame, a Uint8Array as a binary frame.

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

Closes the socket.

Usage

import { type IWebSocketTransport } from "websocket-plugin/src/index.ts";