method WebSocketConnection.prototype.sendJson
WebSocketConnection.prototype.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 { WebSocketConnection } from "websocket-plugin/src/index.ts";