From 033330fd0423027b4de9b8bf903ca7031527bc5a Mon Sep 17 00:00:00 2001 From: MrMasrozYTLIVE <61359286+MrMasrozYTLIVE@users.noreply.github.com> Date: Mon, 10 Jun 2024 20:46:59 +0300 Subject: [PATCH] started working on parsing peers & topics they're currently in on swarm update event using 'swarm.peers' --- chatBot/includes/client.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/chatBot/includes/client.js b/chatBot/includes/client.js index 09964f5..5d68b3f 100644 --- a/chatBot/includes/client.js +++ b/chatBot/includes/client.js @@ -20,7 +20,11 @@ class Client extends EventEmitter { }); this.swarm.on('update', () => { - console.log(`Peers count: ${this.swarm.connections.size}`); + console.log(`Peers count: ${this.swarm.connections.size} (${this.swarm.peers.size})`); + + this.swarm.peers.forEach((peer, peerInfo) => { + console.log(`Peer ${peer} is in topic(s) ${[...peerInfo.topics].map(topic => topic.toString('hex'))}`); + }); }); }