Delivery
For adapter authors
Subscribing
{"id": "2", "op": "subscribe", "body": {"conversation_id": "conv_…"}}
Without a cursor, the server answers with a snapshot. With a cursor that it can still serve, it answers with an acknowledged resume and then sends the missing frames.
{"type": "snapshot", "cursor": {"projection_id": "view_conv_…", "epoch": "e1", "sequence": 47},
"conversation_version": 1, "state": [], "timeline": {"events": []}}
A snapshot is the view at cursor. Apply it first, then apply frames whose sequence is greater than cursor.sequence.
Frames
A frame places one event at one position:
{"type": "frame", "cursor": {"projection_id": "view_conv_…", "epoch": "e1", "sequence": 48},
"event": {"event_id": "evt_…", "type": "robotelos.message", "…": "…"}}
Rules, which every client MUST follow:
- Frames arrive in sequence order.
- Sequences are contiguous. A client that receives 48 after 46 MUST NOT apply 48; it MUST read the missing position or resubscribe.
- A frame with a sequence the client already has MUST be ignored. This makes redelivery safe.
- A frame of a different
epochmeans the journal was rebuilt. The client MUST resnapshot.
Frames are sent to the transport in batches as frames pushes. A batch is only a transport detail: every frame keeps its own cursor, and up_to_date: true marks the point where the client has caught up with the journal.
Reading after a cursor
{"id": "3", "op": "read_after", "body": {"conversation_id": "conv_…", "cursor": {…}, "limit": 50}}
The result carries frames, the new cursor, and up_to_date. When the cursor cannot be served, the result carries resnapshot_reason instead of frames.
Resnapshot
A server MUST demand a resnapshot, rather than send a gap, when:
| Reason | Cause | Client action |
|---|---|---|
cursor_expired | The cursor is older than the server keeps | Subscribe with no cursor |
epoch_changed | The journal was rebuilt | Subscribe with no cursor |
removed | The participant left or was removed from a group | Stop; the conversation is closed for this principal |
In a push, the server sends resnapshot_required with the reason. A client MUST discard its view for that conversation before it applies a new snapshot.
Several connections
A principal may hold several connections, and each one has its own subscriptions. The server sends the same frames to every subscription of a conversation, in the same order. A receipt goes only to the connection that sent the command.
Slow clients
A client that cannot keep up with frames SHOULD bound its queue. The Go SDK does this: a full queue returns ErrSlowConsumer, and the client resumes from its last checkpoint instead of losing events. The server keeps the events, so nothing is lost.
Disconnects
A disconnect ends the subscriptions of that connection. It does not cancel work, and the events that work produces are recorded. A client resumes from its cursor on the next connection.
Next steps
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.