The README has "WebSocket real-time sale feed" listed as planned. Adapt that for streams — when the indexer picks up a new event, push it to connected WebSocket clients in real time instead of waiting for them to poll.
Use case: the frontend dashboard should update live when a stream is created, withdrawn, or cancelled without the user having to refresh. Same for vesting events.
Build a WebSocket server (ws or socket.io, keep it lightweight) that:
- Accepts connections with an optional address filter (only send events for my streams)
- Pushes new events as the indexer processes them
- Handles reconnect gracefully
- Sends initial state on connect (recent events for the subscribed address)
The indexer worker needs a hook to broadcast events after persisting them. Either an event emitter pattern or a simple callback.
Done when:
- WebSocket server running alongside the Express API
- Clients can subscribe to events for a specific address
- New events pushed in real time as indexer processes them
- Initial batch of recent events sent on connect
- Clean disconnect handling
The README has "WebSocket real-time sale feed" listed as planned. Adapt that for streams — when the indexer picks up a new event, push it to connected WebSocket clients in real time instead of waiting for them to poll.
Use case: the frontend dashboard should update live when a stream is created, withdrawn, or cancelled without the user having to refresh. Same for vesting events.
Build a WebSocket server (ws or socket.io, keep it lightweight) that:
The indexer worker needs a hook to broadcast events after persisting them. Either an event emitter pattern or a simple callback.
Done when: