Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/lophus/core/websockets.ts>LazyWebSocket

Fully-modular TypeScript implementation of the Nostr protocol, oriented to web standards and edge environments
Latest
class LazyWebSocket
implements WebSocketLike
import { LazyWebSocket } from "https://deno.land/x/lophus@0.0.13/core/websockets.ts";

A lazy WebSocket that creates a connection when it is needed. It will also wait for the webSocket to be ready before sending any data.

Constructors

new
LazyWebSocket(url: string | URL, protocols?: string | string[])

Properties

addEventListener: WebSocket["addEventListener"]
dispatchEvent: WebSocket["dispatchEvent"]
readonly
readyState: WebSocket["readyState"]
removeEventListener: WebSocket["removeEventListener"]
readonly
url: string

Methods

close(code?: number, reason?: string): Promise<void>
ready(): Promise<void>
send(data: Parameters<WebSocket["send"]>[0]): Promise<void>