-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement WebSocket to Stream Silent Blocks #46
Implement WebSocket to Stream Silent Blocks #46
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more thoughts:
- I see that you are injecting
SilentBlocksGateway
intoSilentBlocksService
. That is not the standard pattern. Gateways are like Controllers. You don't inject controllers into a service, you inject service into a controller. Therefore, please remove the event handling logic fromSilentBlocksService
and move it to inside ofSilentBlocksGateway
. - I also think we should use
socket.io
and leverage the concept of rooms. Once a client connects to use, we can subscribe them to aSILENT_BLOCK
room. Then we just need to publish silent block to that room and let socket.io handle it from there. This will eliminate the need offorEach
loop inbroadcastSilentBlock
Okay, changes noted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you made all the changes I requested. Please do so before I review it again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do the following:
- fix linting issues
- fix broken unit tests
- squash all commits into just one commit
Please Rebase From main |
Okay |
3f0b282
to
4caad8e
Compare
0bb8e57
to
30ba463
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems Good to me, what remains i believe is solve issue for latency.
ff08e74
to
6817e37
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, but let's also add some e2e tests
d1c939c
to
24f3a27
Compare
fixed event emitter issue fix: Add a delay function for silent block events fix: silent block broadcasting Fix: Use a more explicit event name for indexing blocks feat: implement silent block broadcasting fix: Make event emitter protected feat: implement silent block broadcasting fix: Add event emitter and gateway dependencies to tests chore: added makerfile to make local e2e test a breeze added makerfile to make local e2e test a breeze: working improved maker file structure with output logs for debug purpose chore: update vulnerable dependancies Signed-off-by: Anmol Sharma <[email protected]> feat: implement silent block broadcasting fixed event emitter issue fix: Add a delay function for silent block events fix: silent block broadcasting Fix: Use a more explicit event name for indexing blocks feat: implement silent block broadcasting fix: Make event emitter protected feat: implement silent block broadcasting fix: Add event emitter and gateway dependencies to tests fix: clean block provider module Fixes duplicate pm2 dependency and updates packages and Removes unused delay function from common.ts. fix: Remove delay in block processing
24f3a27
to
7a1aa8e
Compare
Fixed all requested changes. |
Objective(s):
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.
Changes:
ws
library.base-block-data-provider.abstract.ts
that emits an event whenever a new block is indexed.SilentBlocksService
and trigger the silent block broadcasting logic when the event is fired.Scope of Change:
This change is semi-critical. While it doesn't directly affect core functionality, it significantly enhances the user experience and system efficiency by providing real-time updates.
solves #45