Skip to content

maskWebSocketPayload

maskWebSocketPayload(payload, maskKey, offset?): Uint8Array<ArrayBuffer>

Defined in: packages/format-websocket/src/frame/mask.ts:12

XOR payload with the 4-byte masking key (RFC 6455 §5.3), into a new array. Masking and unmasking are the same operation.

Runs in O(n) time and allocates O(n) in payload.length; the input is never written to.

Uint8Array

Uint8Array

number = 0

Position of payload[0] within the whole frame payload, so a payload that arrives in pieces can be unmasked piece by piece.

Uint8Array<ArrayBuffer>

The masked (or unmasked) bytes.