function frameByteLength
Since 0.1.0
frameByteLength(data: string | Uint8Array): number

Measures an inbound frame in bytes.

Text frames are measured by their UTF-8 encoding rather than their string length, so a multi-byte payload is not undercounted against the limit.

Parameters

data: string | Uint8Array

The frame

Return Type

number

The frame size in bytes

Usage

import { frameByteLength } from "websocket-plugin/src/index.ts";