Skip to content

Commit

Permalink
methods for abstract pool (#419)
Browse files Browse the repository at this point in the history
* include method to list current pool relays connections and to close all connections

* fix prettier
  • Loading branch information
antonioconselheiro committed Jul 18, 2024
1 parent 54e352d commit 475a22a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions abstract-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

0 comments on commit 475a22a

Please sign in to comment.