WebSocket or SSE channel for stream:updated and settle:finished with auth
## Description
The **StreamPay** dashboard (see `StreamPay-Frontend`) needs **low-latency** updates. Add
backend-first WebSocket or SSE with JWT or session auth, per-stream
subscribe, and backpressure so one tab cannot crush the service. This issue is
not the UI/UX design; that is tracked separately in the design backlog.
Complements existing BullMQ/queue and indexer events.
## Requirements and context
- **Auth** to subscribe to own streams only; `403` on id guessing.
-
Reconnection token pattern; Last-Event-Id for SSE.
-
Message size caps; ping/pong to detect dead clients.
-
Load test: N concurrent clients; memory stability.
-
Security: no PII in event payload beyond what the UI already has.
## Suggested execution
1. `git checkout -b feature/ws-sse-stream-status`
-
Choose WS vs SSE per deploy constraints; document.
-
Tests: integration with fake client; auth negative tests.
-
PR with protocol doc and example curl or websocat for QA.
-
Figma handoff: link event names only (separate project).
- Run the full test suite; add or update tests until the agreed coverage bar is met.
- Cover edge cases listed in this issue; document any intentional exclusions with brief rationale in the PR.
- Include relevant test output (e.g. test runner summary) or a link to a passing CI run in the pull request.
- Add security notes for auth, keys, PII, chain settlement, or money movement (assumptions verified, out-of-scope items).
Example commit message
feat(api): add authenticated WS or SSE for live stream and settlement status updates
Guidelines
- Target: at least 95% coverage on new or meaningfully changed code (per the repo’s standard tooling).
- Documentation: update contributor-facing or API documentation where a reviewer would be blocked without it.
- Timeframe: 96 hours to ready-for-review (surface blockers early).
WebSocket or SSE channel for
stream:updatedandsettle:finishedwith authbackend-first WebSocket or SSE with JWT or session auth, per-stream
subscribe, and backpressure so one tab cannot crush the service. This issue is
not the UI/UX design; that is tracked separately in the design backlog.
Complements existing BullMQ/queue and indexer events.
Reconnection token pattern;
Last-Event-Idfor SSE.Message size caps;
ping/pongto detect dead clients.Load test: N concurrent clients; memory stability.
Security: no PII in event payload beyond what the UI already has.
Choose WS vs SSE per deploy constraints; document.
Tests: integration with fake client; auth negative tests.
PR with protocol doc and example
curlorwebsocatfor QA.Figma handoff: link event names only (separate project).
Example commit message
feat(api): add authenticated WS or SSE for live stream and settlement status updatesGuidelines