Message format
How Blazeauth requests, responses, events, and binary streams are encoded over WebSocket.
Message format
Each Blazeauth operation is identified by a numeric usecase type and an operation-specific JSON payload.
Envelope
Client-to-server requests and server-to-client responses use the same JSON envelope:
type(number): the operation selector (APIUsecaseType).payload(object): the operation-specific request or response body.
Packet id (payload.id)
Every request payload contains an id field (uint64). The server copies this value into the response payload so you can match responses to requests.
Recommendations:
- Keep
idunique within a single WebSocket connection. - If you are implementing a JavaScript client, keep
idwithin the safe integer range (<= 9007199254740991) because JSON numbers lose precision above that.
Responses and status
Most operations include a status field in the response payload.
status = 1means OK.status = 0means “no status” (used in streaming scenarios and usually omitted from JSON).
See Status codes for the full list.
Levels
Some authorization-related responses include levels.
levels is a JSON array of strings.
Server-push events (panel events)
Blazeauth can send asynchronous events to the client.
- Envelope type:
18(panel_event_subscribe) - Payload id:
18446744073709551615(uint64 max)
See Panel events for the event type list.
Binary streaming messages
Some operations (file transfer) stream binary data.
For each streamed chunk the server sends two WebSocket messages:
- A JSON message with a
TransferFileResponsepayload (binary_data: true,chunk_size: N). - A binary WebSocket frame containing exactly
Nbytes.
If chunk_size is 0, the server sends only the JSON message.
See File transfer for the exact streaming behavior.
Note about the envelope
The on-wire envelope (type + payload) is the format used by the Blazeauth socket server. If you use the official SDK, the SDK builds and parses this envelope for you.