UP | HOME

ZIO Message Format

Bytes 4 through 8 inclusive (following the ZIOx) of a ZIO message contain the prefix header form attribute. This is used as a hint to interpreting the remainder of the message. An application may define its own form freely exclusive of reserved forms which are described below. The form should be ASCII and any forms with less than 4 meaningful bytes should be end-padded with ASCII spaces.

ZIO defines and reserves these forms:

BUFF
The BUFF format is essentially no format. It is an anonymous array of bytes. If "parsing" the payload requires merely loading it into a contiguous block of memory then this format is sufficient.
TEXT
The TEXT format is essentially the BUFF format but limited so that each byte is a printable character or otherwise a value that one might typically expect in a std::string. The binary encoding shall be assumed to be UTF-8.
JSON
The JSON format further limits the TEXT format so that the contents may be parsed as a valid JSON document.
BSON
Binary JSON
CBOR
Concise Binary Object Representation
MSGP
MessagePack
UBJS
Universal Binary JSON Specification
PBUF
Protocol Buffers
FLOW
The message participates in ZIO credit-based data flow protocol. More details are in flow.

The forms reserved by ZIO do not specify what, if any, internal schema any structure expressed in the rest of the message may follow. Eg, the TEXT form may or may not be delimited by newlines. Or, a message of JSON form may be an array or an object and its internal structure is not limited as long as it is the whole is represented as a valid JSON document.

Thus, it is up to the application to define these details and their developers must rely on some other means or hints know how to interpret the message payload after it is parsed based on the ZIO form hint. Some guidance and more discussion can be found in message and in peer.