Expand description
The wire vocabulary shared by a Plaza server and whatever talks to it: the
message envelope, the encoding trait (WireCodec) and the common
netcode payloads (payloads).
This crate exists so both ends can agree without the client inheriting the
server’s async runtime. It is pure serde with no async, so a browser, a wasm
build or a native client can depend on it alone; plaza_session re-exports
the codec and plaza core re-exports the payloads, so server code rarely
names this crate directly.
JsonCodec is behind the default json feature. The trait and the
payloads are behind serde, which json turns on, so take them without
JSON with default-features = false, features = ["serde"].
build is behind the non-default build feature and is meant for a
build.rs rather than for the running program: it derives a wire format
version by hashing the source that defines it, so a client built against an
older format can be told to reload instead of half working.
Re-exports§
pub use bit_codec::BitCodec;pub use envelope::Agent;pub use envelope::AgentId;pub use payload::Payload;pub use frame::Kind;
Modules§
- bit_
codec - A
WireCodecthat writes serde types into a bit stream. - bits
- Sub-byte encoding, for fields smaller than a byte.
- build
- Deriving a wire format’s version from the source that defines it, for use
from a
build.rs. - envelope
- Who a message is from.
- flow_
payloads - The flow-control notice payloads: what the turn, round and phase managers wrap into an application’s ops.
- frame
- Framing: the one byte in front of every message that says what it is.
- framing
- Length-delimited stream framing: how frames ride a transport with no message boundaries.
- payload
- Carrying packed bytes without paying for them twice.
- payloads
- The payload vocabulary a server and its clients exchange for prediction, reconciliation and lag compensation.
Structs§
- Json
Codec - JSON wire format. The default: human-readable and easy to inspect from a
browser console or
websocat. - MsgPack
Codec - MessagePack wire format: compact and what a game usually wants once the protocol has stopped changing shape every day.
- MsgPack
Named Codec - MessagePack with struct field names kept, for a peer that decodes by name.
Traits§
- Wire
Codec - Encodes and decodes values on the wire.