From 809d3e774bca8742652be06e7e39b01182dca193 Mon Sep 17 00:00:00 2001 From: Andre Staltz Date: Tue, 6 Feb 2024 14:53:22 +0200 Subject: [PATCH] live watch hubs Set and schedule connections --- lib/scheduler.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/scheduler.js b/lib/scheduler.js index d81ec4d..3ed4b8f 100644 --- a/lib/scheduler.js +++ b/lib/scheduler.js @@ -64,6 +64,12 @@ class Scheduler { for (const multiaddr of multiaddrs) { this.#scheduleWithHub(multiaddr) } + // @ts-ignore + const stopWatch = this.#peer.set?.watch(({subdomain, event, value}) => { + if (subdomain === 'hubs' && event === 'add') { + this.#scheduleWithHub(value) + } + }); } start() {