From 2ae556ad14ef432df65cef09fc2f0c98f9b397f2 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 5 Jan 2023 20:55:46 -0500 Subject: [PATCH] *Add get_topics rpc method --- src/modules/plugins/dht.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/modules/plugins/dht.ts b/src/modules/plugins/dht.ts index 2bd671a..bc97d53 100644 --- a/src/modules/plugins/dht.ts +++ b/src/modules/plugins/dht.ts @@ -21,6 +21,13 @@ const plugin: Plugin = { .map((peerInfo) => b4a.from(peerInfo.publicKey).toString()); }, }); + + api.registerMethod("get_topics", { + cacheable: false, + async handler(topic: string): Promise { + return [...api.swarm.peers.keys()]; + }, + }); }, };