The PP Header

PaindaProtocol structures binary data in a fixed header format for zero-overhead parsing and interoperability. This section is for advanced users who need to implement custom encoders or debug wire format.

Header Layout

Every PP frame starts with a 12-byte header:

// Byte layout (big-endian)
// 0-3:   magic (0x50504E44) "PPND"
// 4-5:   version (uint16)
// 6-7:   flags (uint16): mode, compression, etc.
// 8-11:  payload length (uint32)

Modes

The flags field encodes the engine mode: Chat (0), Media (1), Gaming (2), or Voice (3). This allows the same connection to switch modes without reconnecting.

Payload

After the header, payload length bytes follow. Payload format depends on the mode (e.g. JSON for Chat, binary buffers for Media). See the module docs for per-mode details.