All communication follows a specific envelope structure. Commands sent by the client include a type, command, requestId, sentAt, and a payload. Results returned by the server use type: "command.result" and include an ok boolean, the original requestId, and either a payload (on success) or an error object (on failure).
Error Object Schema:
When ok is false, the error object contains:
code: Error identifier (e.g., VALIDATION_ERROR, NOT_FOUND, RATE_LIMITED, PAYLOAD_TOO_LARGE).message: Human-readable string.retryable: Boolean indicating if the client should attempt the command again.details: An object containing additional context.retryAfterMs: An integer (or null) specifying wait time before retrying.backpressure: Populated only for BACKPRESSURE error types.
// Client Command
{
"type": "command",
"command": "ticket.list",
"requestId": "string",
"sentAt": "2026-07-09T00:00:00Z",
"payload": {}
}
// Successful Result
{
"type": "command.result",
"command": "ticket.list",
"requestId": "string",
"ok": true,
"receivedAt": "2026-07-09T00:00:00Z",
"payload": {}
}
// Failure Result
{
"type": "command.result",
"command": "ticket.list",
"requestId": "string",
"ok": false,
"receivedAt": "2026-07-09T00:00:00Z",
"error": {
"code": "VALIDATION_ERROR",
"message": "string",
"retryable": false,
"resourceType": null,
"resourceId": null,
"details": {},
"retryAfterMs": null,
"backpressure": null
}
}