methods for abstract pool (#419)

* include method to list current pool relays connections and to close all connections

* fix prettier
This commit is contained in:
António Conselheiro
2024-07-18 13:33:29 -03:00
committed by GitHub
parent 54e352d8e2
commit 475a22a95f

View File

@@ -208,4 +208,16 @@ export class AbstractSimplePool {
return r.publish(event)
})
}
listConnectionStatus(): Map<string, boolean> {
const map = new Map<string, boolean>()
this.relays.forEach((relay, url) => map.set(url, relay.connected))
return map
}
destroy(): void {
this.relays.forEach(conn => conn.close())
this.relays = new Map()
}
}