Expand description
Live subscriptions that outlast a relay closing them, and catch-ups for the gaps they leave.
nostr-sdk forgets a subscription a relay CLOSEs for any reason but auth-required or
rate-limited, so neither a reconnect’s re-send nor an unchanged refresh would ask that relay
again: the connection stays healthy while the feed is dead. Every live subscription is kept here
with the filters each relay was sent, and is restored wherever a relay dropped it; the time it
was down is then caught up from that relay.
revive is the return from being away (sleep, App Nap, a backgrounded app, a hidden window,
a network change): every relay proves it is alive or is redialled, every live subscription is
re-armed, and the platform’s CatchUp handler fetches what was missed.
Enums§
- CatchUp
- What a catch-up must cover.
Functions§
- forget
- Stop keeping
id: it was unsubscribed or replaced. - heal
- Restore every kept subscription a connected relay no longer holds. Cheap when nothing is missing: one local lookup per relay and subscription.
- keep
- Keep
idlive on each relay with the filters it was sent there. - keep_
output keepfor a pool-wide subscribe: every relay it reached or failed on, withfilters.- probe_
or_ redial - Every relay answers a cheap probe or has its socket redialled: a suspended process keeps sockets that died without closing. Returns how many connected relays had gone silent; one already down is only retried.
- revive
- Back from being away for
away_ms: every relay answers a probe or is redialled, and every live subscription a relay dropped is restored. The full catch-up then runs whensuspended(the process or its sockets were frozen: sleep, App Nap, a backgrounded app, a network change), after a long absence, or when anything was found broken; otherwise the live feed carried it all. A call while one runs, or just after, is the same return and does nothing. - set_
catch_ up - The platform’s catch-up: DMs and Communities for the live account. Set once at startup.
- start_
wake_ watch - Notice the process waking from a suspension, whichever account is live, and revive it. Once per process.
- watch
- Watch
clientfor relays closing a kept subscription, and check every kept one on a timer. Once per session.