Applesauce
    Preparing search index...
    • Creates a SyncLoader that confidently loads a set of events from multiple relays, some of which may support NIP-77 negentropy sync and some of which may not.

      For each relay it probes for NIP-77 support and then either:

      • runs an efficient negentropy sync (Part 2), falling back to a paginated request if the sync fails, or
      • runs a paginated REQ that pages backward in time until the relay is exhausted (Part 1).

      Calling the loader returns a status$ observable (a full status snapshot on every change) and an events$ observable (the deduplicated events). Both complete when every relay has finished. Subscribing to either observable starts a single shared run that writes received events to the store (deduplicated like the other loaders). A status$ subscriber that joins after the run started replays the latest status snapshot.

      Parameters

      Returns SyncLoader

      const loader = createSyncLoader({ eventStore, pool });
      const { status$, events$ } = loader({ relays, filter: { kinds: [1], authors: [pubkey] } });
      events$.subscribe((event) => console.log(event));
      status$.subscribe((status) => console.log(status));