From 475a22a95f142815bb67f76a4e11e36754c97695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B3nio=20Conselheiro?= <91137293+antonioconselheiro@users.noreply.github.com> Date: Thu, 18 Jul 2024 13:33:29 -0300 Subject: [PATCH] methods for abstract pool (#419) * include method to list current pool relays connections and to close all connections * fix prettier --- abstract-pool.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/abstract-pool.ts b/abstract-pool.ts index 8494962..0655d42 100644 --- a/abstract-pool.ts +++ b/abstract-pool.ts @@ -208,4 +208,16 @@ export class AbstractSimplePool { return r.publish(event) }) } + + listConnectionStatus(): Map { + const map = new Map() + this.relays.forEach((relay, url) => map.set(url, relay.connected)) + + return map + } + + destroy(): void { + this.relays.forEach(conn => conn.close()) + this.relays = new Map() + } }