Skip to main content
The protocol contract is the language-neutral wire contract for Hiro League messages. It defines the JSON shapes that move between Hiro Server, channel plugins, Hiro Gate, and device apps. Python, Dart, and any future client implementation must parse and emit the same contract.

Contract surfaces

The machine-readable contract lives under the repo-level protocol/ folder. The explanatory protocol references live under docs/protocol/.

UnifiedMessage

UnifiedMessage is the canonical cross-channel message envelope.

Message type rules

Routing

routing identifies where the message came from, where it should go, and how it should be grouped. direction is normalized before a message enters Hiro Server: Device-originated messages are normalized by the devices channel before they enter Communication Manager. Inside Hiro Server, consumers can treat direction as server-relative.

Content items

Each content item represents one authored payload. Content order is meaningful. Consumers preserve the order emitted by the sender.

Events

Event messages use message_type: "event" and carry an event payload. Active message events:

Requests and responses

Requests and responses are UnifiedMessage objects with content_type: "json". Request body:
Response body:
Error response body:
request_id is generated by the caller and echoed by the responder.

Gateway envelopes

Hiro Gate wraps forwarded device payloads in a relay envelope.
sender_device_id identifies the connected device that produced the payload. target_device_id is optional and targets a specific connected device when present. payload contains the protocol payload being relayed.

Auth and pairing frames

Gateway auth and pairing frames are type-discriminated JSON objects.

Metadata keys

Protocol metadata keys are part of the contract when behavior depends on them.

Compatibility contract

The protocol is valid when all supported implementations agree on the same fixtures: Schema files and fixtures are the reviewable source of truth. Runtime models in Python and Dart implement that contract.

See also

UnifiedMessage reference

Detailed field reference, validation rules, constants, and wire examples.

Communication Manager

How Hiro Server validates, routes, adapts, and dispatches UnifiedMessages.

Channel Manager

How channel plugins send and receive UnifiedMessages through Hiro Server.

Gateway runtime

How Hiro Gate handles device connections.

Channel Plugins

The plugin-side JSON-RPC contract around UnifiedMessage payloads.