sigildocs

(sigil websocket frame)

(sigil websocket frame) - WebSocket Frame Encoding/Decoding

Implements RFC 6455 WebSocket frame format. Handles frame construction, parsing, masking, and fragmentation.

Exports

Check if opcode is a control frame (close, ping, pong)

Check if opcode is a control frame (close, ping, pong)

ws-frameprocedure

Construct a ws-frame struct.

ws-frame?procedure

Test if a value is a ws-frame struct.

ws-frame-fin?procedure

Get the fin? field of a ws-frame struct.

Get the opcode field of a ws-frame struct.

Get the payload field of a ws-frame struct.

Get the payload field of a ws-frame struct.

Construct a frame-decode-result struct.

Test if a value is a frame-decode-result struct.

Get the frame field of a frame-decode-result struct.

Get the bytes-consumed field of a frame-decode-result struct.

Create a bytevector from a list of bytes

Create an empty bytevector

Generate a random 4-byte mask key Returns a bytevector of length 4

apply-maskprocedure

Apply XOR mask to data Returns new bytevector with masked data

encode-frameprocedure

Encode a WebSocket frame Client frames MUST be masked per RFC 6455

Encode a text frame (always masked for client)

Encode a binary frame (always masked for client)

Encode a close frame with optional status code

Encode a ping frame

Encode a pong frame (usually echo of ping payload)

Encode a text frame for server-to-client delivery (unmasked).

Encode a binary frame for server-to-client delivery (unmasked).

Encode a close frame from the server (unmasked). Optional close code per RFC 6455 §7.4.

Encode a ping frame from the server (unmasked).

Encode a pong frame from the server (unmasked). Pong payload must equal the originating ping's payload.

decode-frameprocedure

Decode a WebSocket frame from bytevector Returns frame-decode-result with frame and bytes consumed Returns result with #f frame if incomplete data

(No description)

opcode-textvariable

(No description)

(No description)

opcode-closevariable

(No description)

opcode-pingvariable

(No description)

opcode-pongvariable

(No description)