Exclosured.Protocol (exclosured v0.1.4)

Copy Markdown

Binary encoding protocol for high-frequency state synchronization.

Encodes Elixir terms into compact binary format for efficient transfer to WASM modules, avoiding JSON serialization overhead.

Wire Format

Each value is prefixed with a 1-byte type tag:

  • 0x01 - integer (signed 64-bit big-endian)
  • 0x02 - float (64-bit IEEE 754)
  • 0x03 - string (32-bit length prefix + UTF-8 bytes)
  • 0x04 - binary (32-bit length prefix + raw bytes)
  • 0x05 - list (32-bit count + encoded elements)
  • 0x06 - map (32-bit count + key/value pairs)
  • 0x07 - boolean (1 byte: 0 = false, 1 = true)
  • 0x08 - nil
  • 0x09 - atom (encoded as string)

Summary

Functions

Decode a binary wire format back into an Elixir term.

Encode an Elixir term into the binary wire format.

Functions

decode(binary)

Decode a binary wire format back into an Elixir term.

encode(term)

Encode an Elixir term into the binary wire format.