Module

x/abc/vendor/https/deno.land/std/ws/mod.ts>WebSocket

A better Deno framework to create web application.
Go to Latest
interface WebSocket
implements AsyncIterable<WebSocketEvent>
import { type WebSocket } from "https://dotland.deno.dev/x/abc@v1.2.4/vendor/https/deno.land/std/ws/mod.ts";

Properties

readonly
conn: Deno.Conn
readonly
isClosed: boolean

Methods

[[Symbol.asyncIterator]](): AsyncIterableIterator<WebSocketEvent>
send(data: WebSocketMessage): Promise<void>
ping(data?: WebSocketMessage): Promise<void>
close(): Promise<void>

Close connection after sending close frame to peer. This is canonical way of disconnection but it may hang because of peer's response delay. Default close code is 1000 (Normal Closure)

close(code: number): Promise<void>
close(code: number, reason: string): Promise<void>
closeForce(): void

Close connection forcely without sending close frame to peer. This is basically undesirable way of disconnection. Use carefully.