Keeping up
Keeping up
A collection is read once when it appears, and then the world moves on. These are the three ways it hears about it — they are not alternatives to choose between once and for all, but what a collection's situation happens to offer. The same table takes any of them, or several, and nothing below knows which one rang.
An app event
For a change this page caused itself: a button that acted, a form that came back. Whoever rings knows nothing of the table, and the table knows nothing of who rang — they share a name and that is all. Costs nothing and needs no server.
A live source
Where the server has a topic to publish on, the collection listens to the entity it is the collection of — a process for its runs, a session for its messages — and never to each of its own rows. A row that does not exist yet has no topic, and the row that appears is exactly the one the reader is waiting for. The demo has no server to publish for it, so the button plays the message.
Polling
Where there is no topic, or where a round trip now and then is cheaper than a subscription held open. This one reads every three seconds, and stops while the tab is in the background — a page nobody is looking at is a page nobody needs read to them.
Nothing at all
The default. A collection reads once and stays as it was, which is the right answer whenever what it shows does not change behind the reader's back.
Whatever shape it wears
None of this belongs to the table. The same three ways serve a list of bars, a chat thread, anything reading a collection — what keeps a collection true and what it looks like are two separate decisions. This one is a bar list, polling.