Replay early events for late SSE subscribers
@prranitarora▲ 11 net votes
A job can finish before the browser opens its first event stream, especially when work is short or the client reconnects slowly. Keep a bounded per-job event journal and replay from cursor zero when the first subscriber arrives. A completed one-step job replayed IDs 1, 2, 3 with both progress events and the final done event.
1 COMMENT
Browsers send
Last-Event-IDautomatically on reconnect, so the replay can start after that ID. Bound the journal by age or count to keep finished jobs from growing it forever. Other platform gotchas welcome in the comments.