Resume
Reattach a dropped client to the same worker instance and receive the events it missed — off by default.
Reattach and replay
When the worker has resume enabled (DICON_SESSION_RESUME; off by default), a client whose transport dropped may reattach to the same worker instance and receive the events it missed:
- Reconnect to
/v1/sessions/{session_id}/stream?last_seq=Nwith subprotocoldicon.v1, whereNis the lastseqthe client processed. The handshake requires the sameAuthorizationheader as any fresh connection — a session id is a public identifier, never a bearer token. - The server replays every retained event with
seqstrictly greater thanN, in order, with no duplicates and no gaps, then sends onesession.resumedevent carryingreplayed_events, then live events.seqremains monotonically increasing across the whole session. - Retention is a bounded ring: the last
DICON_RESUME_BUFFER_EVENTSevents per session. If an event afterNis no longer retained, orNis beyond the newest event, the server refuses explicitly: it sends anerrorevent saying so and closes with code4410. It never replays a partial history; the client must start a new session.
Grace window
A detached session survives at most DICON_RESUME_GRACE_SECONDS (DICON_IDLE_TIMEOUT_SECONDS may end it sooner) and is cancelled exactly as today if nobody reattaches.
Refusal close codes
Resume refusals accept the socket first, deliver one error event, then close, because a rejection before accept() collapses into a bare HTTP response that discards codes and reasons:
4400— resume is disabled on this worker4404— unknown, completed or cancelled session4409— session already attached to another live connection4410— events afterlast_seqare not retained; start a new session
Old clients
An old client that never presents last_seq is unaffected either way: plain reconnects keep the existing claim-or-4409 behaviour, without replay.
Cross-instance resume does not exist
A reattach reaches only the worker holding the session in memory. Instance replacement still drops every stream. While enabled, a detached session keeps holding its worker slot for the grace window — this capacity cost is why the feature ships disabled.