Skip to content

WS/SSE: push model for live stream and settlement status to dashboard clients (backend) #142

@greatest0fallt1me

Description

@greatest0fallt1me

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`
    
  1. Choose WS vs SSE per deploy constraints; document.

  2. Tests: integration with fake client; auth negative tests.

  3. PR with protocol doc and example curl or websocat for QA.

  4. Figma handoff: link event names only (separate project).

     ## Test and commit
    
  • 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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-streamsStreamPay ghit: area-streamsdomain-apiStreamPay ghit: domain-apipriority-p2StreamPay ghit: priority-p2type-featureStreamPay ghit: type-feature

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions