Connect, subscribe and yield each event until close(), or until a
ZmqSetupError ends the iteration. One consumer at a time: a second
iteration while one runs throws.
Stop: closes the socket and ends the iteration.
A snapshot of what the subscriber has observed. See ZmqHealthStatus.
The last message's age is measured on the monotonic clock
(performance.now()), so a step in the wall clock makes a fresh
subscriber neither stale nor an old one receiving. now is the
wall-clock time (Date.now() units) to report the status at, by default
the present: the age is shifted by now - Date.now(), so
health(Date.now() + 60_000) tells whether the subscriber will be stale
in a minute if no message arrives meanwhile.
Optionalnow: number
Subscribes to qbitd's ZMQ notifications and yields parsed messages, gaps in each topic's sequence counter, malformed messages and socket replacements. The socket is replaced when a receive fails or the connection drops. Counters are tracked across replacements, and the first message on each topic after one is always reported as a gap, since messages published meanwhile are lost and a restarted qbitd's counter can happen to line up. A gap is the signal to reconcile over RPC (for blocks,
getbestblockhashand walk back withgetblockheader): ZMQ is a wake-up, not a ledger. A failure that retrying cannot fix (azeromqmodule that does not load, an addressconnect()refuses) ends the iteration with a ZmqSetupError instead.One consumer at a time: iterate it with
for await.