Skip to content

feat(sync): resume SSE streams from the last event - #1300

Merged
everpcpc merged 3 commits into
mainfrom
feat/sse-resume
Oct 28, 2026
Merged

everpcpc merged 3 commits into
mainfrom
feat/sse-resume

Conversation

@everpcpc

@everpcpc everpcpc commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

What

  • Resume SSE connections with the last received domain-event ID, allowing kmrs to replay retained events before returning to the live stream.
  • Parse SSE frames line by line, including event IDs, multi-line data, heartbeats, and id-less task snapshots.
  • Scope cursors to the current account and reset them on login, logout, and server switches while preserving them across lifecycle suspension and preference toggles.
  • Isolate old streams and delayed reconnects so they cannot overwrite the state of a newer connection.

Why

kmrs now supports bounded replay of missed SSE events. KMReader previously discarded event IDs, so a temporary connection gap could miss content changes. The cursor is intentionally memory-only and best-effort; an expired or foreign cursor starts live without requiring a custom recovery event.

Validation

  • make format
  • make build — iOS, macOS, and tvOS all passed.
  • Installed the iOS build in the iPhone 18 Pro simulator and verified against the configured kmrs server: initial SSE connection and disabling/re-enabling Real-time Updates both succeeded.
  • The test server emitted no domain event during the simulator check, so an actual replay and the outbound Last-Event-ID header were not observed end to end.

🤖 Generated with Claude Code

@everpcpc
everpcpc merged commit 3e78385 into main Oct 28, 2026
3 checks passed
@everpcpc
everpcpc deleted the feat/sse-resume branch October 28, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant