Bitshala-Incubator / silent-pay-indexer

An indexer for serving bitcoin silent payment indexes!!
MIT License
5 stars 6 forks source link

Implement WebSocket to Stream Silent Blocks #45

Open theanmolsharma opened 2 weeks ago

theanmolsharma commented 2 weeks ago

Description: Implement a WebSocket connection to stream silent blocks to the client whenever a new block is found and indexed. This will eliminate the need for the client to keep polling for new blocks.

Tasks:

  1. Set up a WebSocket server.
  2. Implement a method to broadcast new silent blocks to connected clients.
  3. Add a function to src/block-data-providers/base-block-data-provider.abstract.ts that emits an event whenever a new block is indexed.
  4. On receiving the event, the SilentBlocksService should create and stream the silent block to all connected clients.
  5. Ensure the WebSocket connection is properly managed and closed when clients disconnect.