mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-08 16:28:49 +00:00
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:
committed by
GitHub
parent
54e352d8e2
commit
475a22a95f
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user