kernl API
    Preparing search index...

    Function subscribeWithEose

    • Subscribe through the pool's raw req so the end of stored events is observable: EOSE is reported once, after every relay has answered or failed, and events are deduplicated by id because req does not. applesauce's subscription() deduplicates but hides EOSE, which kehto's relay service relies on to answer relay.subscribe.

      Parameters

      • pool: Pick<ApplesaucePool, "req">

        The shared applesauce pool.

      • relays: string[]

        Relay URLs to ask.

      • filters: NostrFilter[]

        Filters for the request.

      • callback: (item: NostrEvent | "EOSE") => void

        Receives each new event once, then 'EOSE'.

      Returns EoseSubscription

      A handle that closes the subscription.

      const sub = subscribeWithEose(pool, ['wss://relay.example'], [{ kinds: [1] }], (item) => {
      if (item !== 'EOSE') console.log(item.id);
      });
      sub.unsubscribe();