Documentation
    Preparing search index...

    Interface Nip66RelayPool

    Minimal relay-pool contract @kehto/nip/66 depends on. Consumers implement this against their pool library of choice (nostr-tools SimplePool, applesauce-relay, @snort/worker-relay, etc.). Intentionally smaller than RxJS-style observable pools — one callback, one unsubscribe handle.

    import { SimplePool } from 'nostr-tools/pool';
    const pool = new SimplePool();
    const adapter: Nip66RelayPool = {
    subscribe: (relays, filter, onEvent) => {
    const sub = pool.subscribeMany(relays, [filter], { onevent: onEvent });
    return () => sub.close();
    },
    };
    interface Nip66RelayPool {
        subscribe(
            relays: readonly string[],
            filter: Nip66Filter,
            onEvent: (event: NostrEvent) => void,
        ): () => void;
    }
    Index

    Methods

    Methods

    • Open a kind-30166 subscription against a set of monitor relays.

      Parameters

      • relays: readonly string[]

        WebSocket URLs to subscribe against (the aggregator passes its bootstrap list)

      • filter: Nip66Filter

        A kind-30166 filter, optionally narrowed with #n network tags

      • onEvent: (event: NostrEvent) => void

        Called synchronously with every matching event; the aggregator parses each one

      Returns () => void

      An unsubscribe handle the aggregator calls on resync() or teardown