Documentation
    Preparing search index...

    Interface RelayPoolHooks

    Hook for relay pool operations. Host app provides relay connectivity.

    const relayPoolHooks: RelayPoolHooks = {
    getRelayPool: () => myPool,
    trackSubscription: (key, cleanup) => subscriptions.set(key, cleanup),
    // ...
    };
    interface RelayPoolHooks {
        closeScopedRelay(windowId: string): void;
        getRelayPool(): RelayPoolLike | null;
        openScopedRelay(
            windowId: string,
            relayUrl: string,
            subId: string,
            filters: NostrFilter[],
            sourceWindow: Window,
        ): void;
        publishToScopedRelay(windowId: string, event: NostrEvent): boolean;
        selectRelayTier(filters: NostrFilter[]): string[];
        trackSubscription(subKey: string, cleanup: () => void): void;
        untrackSubscription(subKey: string): void;
    }
    Index

    Methods

    • Close a scoped relay connection.

      Parameters

      • windowId: string

      Returns void

    • Open a scoped relay connection (NIP-29 groups).

      Parameters

      • windowId: string
      • relayUrl: string
      • subId: string
      • filters: NostrFilter[]
      • sourceWindow: Window

      Returns void

    • Track a subscription for lifecycle management.

      Parameters

      • subKey: string
      • cleanup: () => void

      Returns void

    • Untrack and clean up a subscription.

      Parameters

      • subKey: string

      Returns void