[]previous and next page

WebSocketClient

A running WebSocket client.

A running WebSocket client.

Import#

ts
import type { WebSocketClient } from "@shadow-js/dusk/client";

Signature#

ts
interface WebSocketClient {
  /** Sends a message. Returns false, and sends nothing, when the socket is not open. */
  send(data: string | BufferSource): boolean;
  /** Closes the socket (code 1000 by default) and stops reconnecting. */
  close(code?: number, reason?: string): void;
  /** The current status. */
  readonly status: StreamStatus;
}

Members#

Name Type Description
send send(data: string | BufferSource): boolean Sends a message. Returns false, and sends nothing, when the socket is not open.
close close(code?: number, reason?: string): void Closes the socket (code 1000 by default) and stops reconnecting.
status readonly status: StreamStatus The current status.