Compute the UTF-8 byte length of a raw WebSocket frame payload.
For binary frames the ArrayBuffer.byteLength is exact. For text frames the
UTF-8 size is counted directly from the JS string without allocating an
encoder buffer, so an oversized frame can be rejected cheaply.
Compute the UTF-8 byte length of a raw WebSocket frame payload.
For binary frames the
ArrayBuffer.byteLengthis exact. For text frames the UTF-8 size is counted directly from the JS string without allocating an encoder buffer, so an oversized frame can be rejected cheaply.