feat: Add subscriptionDetails getter to RelayHub for detailed subscription information
- Implement a new getter method in RelayHub to return an array of subscription details, including IDs, filters, and associated relays. - Enhance the ability to track and manage subscriptions more effectively within the RelayHub component.
This commit is contained in:
parent
8fb0c40797
commit
48761e8035
4 changed files with 150 additions and 2 deletions
|
|
@ -97,6 +97,17 @@ export class RelayHub extends EventEmitter {
|
|||
return this.subscriptions.size
|
||||
}
|
||||
|
||||
get subscriptionDetails(): Array<{ id: string; filters: any[]; relays?: string[] }> {
|
||||
return Array.from(this.subscriptions.entries()).map(([id, subscription]) => {
|
||||
// Try to extract subscription details if available
|
||||
return {
|
||||
id,
|
||||
filters: subscription.filters || [],
|
||||
relays: subscription.relays || []
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
get relayStatuses(): RelayStatus[] {
|
||||
return Array.from(this.relayConfigs.values()).map(config => {
|
||||
const relay = this.connectedRelays.get(config.url)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue