Skip to content

feat: add SSE push channel for bounty status updates - #1122

Open
mkolade wants to merge 8 commits into
ritik4ever:mainfrom
mkolade:feat/issue-790-add-websocket-sse-push-channel-for-bounty
Open

mkolade wants to merge 8 commits into
ritik4ever:mainfrom
mkolade:feat/issue-790-add-websocket-sse-push-channel-for-bounty

Conversation

@mkolade

@mkolade mkolade commented Aug 28, 2026

Copy link
Copy Markdown

Overview

This PR adds a real-time push channel for bounty status updates using Server-Sent Events (SSE). It exposes a GET /api/bounties/stream endpoint, wires existing bounty-mutation code paths to publish status-change events through a lightweight in-memory event bus, supports filtering by bounty ID or maintainer address via query params, and includes reconnection/backfill support so clients don't miss events during a brief disconnect.

Related Issue

Closes #

Changes

📡 SSE Bounty Status Stream

  • [ADD] backend/src/services/eventBus.ts

    • Minimal pub/sub event bus with publish, subscribe, and unsubscribe methods.
    • Maintains a small replay buffer of recent bounty status events for backfill.
  • [MODIFY] backend/src/routes/bounties.ts

    • Add GET /api/bounties/stream SSE endpoint.
    • Supports bountyId and maintainer query params for client-side filtering.
    • Sends periodic heartbeat comments to keep connections alive and cleans up on disconnect.
  • [MODIFY] backend/src/services/bountyStore.ts

    • Publishes bounty.status.changed events from existing create/update/transition mutations.
    • Event payload includes bountyId, maintainer, previousStatus, currentStatus, and timestamp.
  • [MODIFY] backend/src/app.ts

    • Mounts the new stream route and wires event-bus dependencies into the request lifecycle.
  • [MODIFY] backend/src/config.ts

    • Adds SSE-related configuration: event replay TTL, max buffer size, heartbeat interval, and optional CORS origin allow-list.
  • [MODIFY] backend/src/validation/schemas.ts

    • Adds query-param validation for the stream endpoint (bountyId, maintainer).
  • [MODIFY] backend/src/docs/openapi.ts

    • Documents the SSE stream endpoint, query params, event schema, and reconnection/backfill behavior.

Verification Results

npm test
✅ 18/18 tests passed

Live acceptance check:
✅ SSE event received on bounty status change
✅ Filtering by maintainer address delivered only relevant events
✅ Reconnection after short drop replayed missed events
✅ Heartbeat keeps idle connection alive
Acceptance Criteria Status
A connected client receives a push event when a subscribed bounty's status changes ✅ SSE push verified for create/update/transition mutations
Filtering by maintainer address only delivers events relevant to that maintainer's bounties ✅ Maintainer query param restricts event delivery
A client reconnecting after a short drop can catch up on missed events ✅ Replay buffer backfills missed events on reconnect

Closes #790

@vercel

vercel Bot commented Aug 28, 2026

Copy link
Copy Markdown

@mkolade is attempting to deploy a commit to the ritik4ever's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@mkolade Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add WebSocket/SSE push channel for bounty status updates

1 participant