method IWebSocketConnection.sendJson
IWebSocketConnection.sendJson<T>(payload: T): void

Serializes a value to JSON and sends it as a text frame.

Type Parameters

The payload type

Parameters

payload: T

The value to serialize

Return Type

void

Throws

Error

If the connection is no longer open

Usage

import { type IWebSocketConnection } from "common/src/index.ts";