Expand description
JSON-line framing codec shared by link transports.
The link wire convention is one serde-JSON document per line (the same
convention as the debug server). Transports add the \n framing
themselves: a TCP transport writes the line to a socket, a Web
BroadcastChannel transport posts it as a string. Both share
encode_line/decode_line so framing stays byte-identical across
transports.
This module is pure serde — no I/O, no platform calls — which is why it lives in the engine (the zero-I/O layer) while the transports that use it live in the game or platform layer.
Broadcast-style channels deliver every post to EVERY participant on the
channel — including the sender’s own — so broadcast frames are wrapped in
a Frame envelope carrying a random per-session tag, and receivers
drop frames whose tag is their own (Frame::is_self). The envelope is
pure serde, so it is defined (and tested) here rather than inside any
one transport.
Structs§
- Frame
- A broadcast-channel frame: the sender’s per-session tag plus the protocol message.
Functions§
- decode_
line - Deserialize one JSON line.
- encode_
line - Serialize a value as one JSON line (no trailing newline — the transports
add the
\nframing themselves).