Skip to main content

Module news

Module news 

Source
Expand description

What a listening client is told as news: everything sent since it began listening, once, however it reached this device (live, a catch-up, a replay). What came before is history: stored, never announced.

Once is anchored on the store: an event is news only the first time this device keeps it, so the paths that can carry it (the live feed, every catch-up, a replay) race harmlessly.

Constants§

ALLOWANCE_MS
How long before listening began an event still counts: senders’ clocks drift, and what was sent while the client started reached nobody else.

Functions§

cutoff
The earliest send time (unix ms) still news to this session’s listener.
first_telling
Whether to tell this session’s listener about id (an event id, or any 32 bytes naming one thing that happened): true the first time, and always when nobody is listening.
first_telling_hex
first_telling for a hex id; anything else names itself through a hash.
is_news
Whether something sent at at_ms is news. With a listener: sent since it began. Without one (a UI paints history anyway), only what is fresh now.
listening_since
When this session’s listener began (unix ms), if one is listening.