std@0.95.0/ws/mod.ts

Deno standard library
GitHub Stars
2260
Go to Latest

WebSocket

import { type WebSocket } from "https://deno.land/std@0.95.0/ws/mod.ts";
interface WebSocket extends AsyncIterable<WebSocketEvent> {
readonly conn: Deno.Conn;
readonly isClosed: boolean;
[[Symbol.asyncIterator]](): AsyncIterableIterator<WebSocketEvent>;
send(data: WebSocketMessage): Promise<void>;
ping(data?: WebSocketMessage): Promise<void>;
close(): Promise<void>;
close(code: number): Promise<void>;
close(code: number, reason: string): Promise<void>;
closeForce(): void;
}