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.
Parameters
Section titled “Parameters”payload
Section titled “payload”Uint8Array
maskKey
Section titled “maskKey”Uint8Array
offset?
Section titled “offset?”number = 0
Position of payload[0] within the whole frame payload, so a
payload that arrives in pieces can be unmasked piece by piece.
Returns
Section titled “Returns”Uint8Array<ArrayBuffer>
The masked (or unmasked) bytes.