managarten/services/mana-sync
Till JS 068a64b275 feat(sync): add SSE streaming endpoint for real-time sync
New endpoint GET /sync/{appId}/stream sends Server-Sent Events with
change data directly, replacing the WebSocket notification + HTTP pull
round-trip pattern.

Server (Go):
- HandleStream() in handler.go: SSE endpoint with initial sync + live streaming
- Hub.Subscribe()/Unsubscribe() in hub.go: channel-based SSE subscriber system
- Notification type for type-safe SSE events
- convertChanges() helper extracted from duplicated code
- WriteTimeout set to 0 for SSE long-lived connections

Protocol: Client connects to /sync/{appId}/stream?collections=a,b&since=...
Server sends initial changes, then streams live changes as other clients sync.
Heartbeat every 30s keeps connection alive. Push still uses POST /sync/{appId}.

WebSocket remains available as fallback (not removed).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 22:24:10 +02:00
..
cmd/server feat(sync): add SSE streaming endpoint for real-time sync 2026-04-02 22:24:10 +02:00
internal feat(sync): add SSE streaming endpoint for real-time sync 2026-04-02 22:24:10 +02:00
test refactor: rename ManaDeck to Cards across entire monorepo 2026-04-01 11:45:21 +02:00
CLAUDE.md feat(mana-sync): unified WebSocket — one connection per user instead of 27 2026-04-02 13:09:10 +02:00
Dockerfile feat(local-first): add local-first architecture with Dexie.js, Go sync server, and Todo pilot 2026-03-27 11:17:58 +01:00
go.mod refactor(shared-go): extract shared auth package from 3 Go services 2026-04-02 13:27:44 +02:00
go.sum refactor(shared-go): extract shared auth package from 3 Go services 2026-04-02 13:27:44 +02:00
package.json feat(local-first): add local-first architecture with Dexie.js, Go sync server, and Todo pilot 2026-03-27 11:17:58 +01:00