GNU Artanis provides a Websocket data frame struct, as defined in RFC6455.
The frame will not be decoded or parsed into a record-type, but will be kept as the binary frame read from the client, and use bitwise operations to fetch fields. This kind of ‘lazy’ design saves much time as it doesn’t parse unused fields, and makes it easier to redirect without any serialization. If users want to get a certain field, Artanis provides APIs for fetching them. Users can decide how to parse the frames by themselves, which we think is more efficient.
Here are the APIs you can use:
(websocket-frame? <websocket-frame>)
;; parser: bytevector -> custom data frame (websocket-frame-parser <websocket-frame>)
websocket-frame-parser is the registered reader for the protocol specified by the #:websocket
configuration. The protocol is customizable based on protobuf. NOTE: Custom protocols support hasn’t been implemented yet.
(websocket-frame-head <websocket-frame>) (websocket-frame-final-fragment? <websocket-frame>) (websocket-frame-opcode <websocket-frame>) (websocket-frame-payload <websocket-frame>) (websocket-frame-mask <websocket-frame>)
To get the Websocket frame information. See Data framing for details.