-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 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 <anmolsharma0234@gmail.com> 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
- Loading branch information
1 parent
5d30c84
commit 7a1aa8e
Showing
14 changed files
with
169 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const INDEXED_BLOCK_EVENT = 'INDEXED_BLOCK_EVENT'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Injectable, Logger } from '@nestjs/common'; | ||
import { | ||
WebSocketGateway, | ||
WebSocketServer, | ||
OnGatewayConnection, | ||
OnGatewayDisconnect, | ||
} from '@nestjs/websockets'; | ||
import { Server, WebSocket } from 'ws'; | ||
|
||
@Injectable() | ||
@WebSocketGateway() | ||
export class SilentBlocksGateway | ||
implements OnGatewayConnection, OnGatewayDisconnect | ||
{ | ||
private readonly logger = new Logger(SilentBlocksGateway.name); | ||
|
||
@WebSocketServer() server: Server; | ||
|
||
handleConnection(client: WebSocket) { | ||
const remoteAddress = (client as any)._socket.remoteAddress; | ||
this.logger.debug(`Client connected: ${remoteAddress}`); | ||
} | ||
|
||
handleDisconnect(client: WebSocket) { | ||
const remoteAddress = (client as any)._socket.remoteAddress; | ||
this.logger.debug(`Client disconnected: ${remoteAddress}`); | ||
} | ||
|
||
broadcastSilentBlock(silentBlock: Buffer) { | ||
for (const client of this.server.clients) { | ||
if (client.readyState === WebSocket.OPEN) { | ||
client.send(silentBlock); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.