On this page

    M

    http.websocketUnmask

    History
    http.websocketUnmask(buffer, mask): void
    Attributes
    The data to unmask, in place.
    The 4-byte masking key.

    XORs every byte of buffer with mask, repeated, in place: byte i is XORed with byte i % 4 of mask. This is equivalent to http.websocketMask(buffer, mask, buffer, 0, buffer.byteLength), and is typically used to unmask a received WebSocket frame payload (RFC 6455, Section 5.3). See http.websocketMask() for an example.

    An error is thrown, and nothing is written, if mask is not exactly 4 bytes long or if buffer is backed by an immutable ArrayBuffer.