Skip to main content

Module codec

Module codec 

Source
Expand description

Framing: a 4-byte little-endian length, then one message in MessagePack (default) or JSON (MOUSER_MODE_WIRE=json, for authors in any language).

Enums§

Wire

Constants§

MAX_FRAME
Larger frames are refused (an inline 4K RGBA frame is ~33 MB).

Functions§

read
Read one message; Ok(None) at a clean end of stream. buf is reused.
write
Write one message, MessagePack structs as arrays (the plugin side: the host reads both shapes).
write_named
Write one message with MessagePack structs as maps keyed by field name (what the host sends a plugin). A plugin built before a field was added skips the unknown key; as an array the extra element made its decoder fail (“array had incorrect length”) and the plugin exit at the handshake. Plugins built from any mode-api version read both shapes.