Protocol¶
Low-level serialization functions. You won't need these unless you're building custom transport.
encode(data: dict) -> bytes¶
Serialize a dict to a length-prefixed msgpack frame.
decode(data: bytes) -> dict¶
Deserialize raw msgpack bytes (without the length header).
read_message(stream: bytes) -> tuple[dict | None, int]¶
Extract one complete message from a byte buffer. Returns (message, bytes_consumed) or (None, 0) if the buffer doesn't contain a complete message yet.