Skip to content

feat: Real-time UI updates via WebSocket/SSE subscription (client-side) #626

@joelpeace48-cell

Description

@joelpeace48-cell

Background & current state

The UI polls for updates (frontend/src/hooks/useCampaignPolling.js). Polling is wasteful and laggy. Backend real-time exists/planned (WS #456, Horizon SSE #468), but the frontend doesn't consume a live stream.

Goal

Consume a WebSocket/SSE stream client-side so campaign/participant state updates live, with reconnect/backoff and cache reconciliation.

Technical design

Edge cases

  • Connection drop → backoff reconnect + resume; fall back to polling.
  • Out-of-order/duplicate events → idempotent cache updates.
  • Many tabs → shared worker or per-tab connection cap.
  • Auth for the stream.

Task breakdown

  • Subscription client + reconnect/backoff + polling fallback.
  • Cache reconciliation for live events.
  • Replace/augment useCampaignPolling.
  • E2E observing a live update.

Acceptance criteria

  • Participant count/claims update live without manual refresh; degrades to polling on disconnect.

Testing & verification

  • E2E: trigger a backend event → UI updates without refresh.

Out of scope

Dependencies / related

Difficulty: medium · Effort: M · stellar

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions