ark::comms::WebSocketFrameHeader

Defined in header “ark/comms/websocket_protocol.hh”.


Represents a frame of data to be transmitted over a websocket. This can be encoded or decoded.

Methods

  • size_t encode(uint8_t * array, size_t array_size)
    Encodes the frame header into the given byte array. Returns the number of bytes actually used for encoding.

  • size_t decode(const uint8_t * array, size_t array_size)
    Decodes the frame header from the given byte array. Returns the number of bytes actually consumed by decoding. Throws if there are insufficient bytes.

  • std::pair< bool, size_t > try_decode(const uint8_t * array, size_t array_size)
    Decodes the frame header from the given byte array. Returns the number of bytes actually consumed by decoding. Throws if there is an error, otherwise, returns a pair indicating if a frame was parsed, and the size of bytes needed/consumed for/during decoding.

  • bool operator==(const WebSocketFrameHeader & other)
    Comparison operator (just defaulted).

Variables

  • WebSocketOpcode opcode= WebSocketOpcode::TEXT
    The opcode (indicates text, binary, etc).

  • uint64_t payload_length= 0
    Overall message length.

  • std::optional< uint32_t > masking_key
    Masking key (may not be present).