Skip to main content

Module codec

Module codec 

Source
Expand description

CLASP Binary Codec

Efficient binary encoding for all CLASP messages. Backward compatible: can decode v2 MessagePack frames.

§Performance

Compared to v2 (MessagePack with named keys):

  • SET message: 69 bytes → 32 bytes (54% smaller)
  • Encoding speed: ~10M msg/s (vs 1.8M)
  • Decoding speed: ~12M msg/s (vs 1.5M)

Modules§

msg
Message type codes
phase
Gesture phase codes
sig
Signal type codes
val
Value type codes for efficient binary encoding

Constants§

ENCODING_VERSION
Encoding version (1 = binary encoding, 0 = MessagePack legacy)

Functions§

decode
Decode a frame and extract the message
decode_message
Decode a message - auto-detects MessagePack (legacy) vs binary encoding
decode_payload
Helper to decode just a message payload (without frame)
encode
Encode a message into a complete frame (binary encoding)
encode_message
Encode a message to binary format
encode_payload
Helper to encode just the message payload (without frame) - binary encoding
encode_with_options
Encode a message with options (binary encoding)