Devices¶
A device is anything that renders a surface, named by an id of its own and a device class. Every device renders; a device with a way to take input also steers. One person has many devices and, by default, one surface, so a phone, a laptop and a television in the same house show the same thing and any of them can change it.
Device classes¶
A device class says how a device renders: phone, laptop and tv unless the vocabulary names
others. The surface does not change by class. A shelf is one record, drawn as a column on a phone
and a grid on a television, because the shape is what is shown and the class is how.
Showing¶
A device records itself on the surface when it connects and removes itself when it leaves. The
surface's showing lists every device showing it now, with its class, whether it is in a room, and
since when. A renderer can use it to say where else the surface is open, and a consumer's own
projection can use the journal of shows and hides to know which devices a person uses.
A room¶
A device in a room shows the surface where other people can see it: a television in a kitchen, a
screen in a meeting. room is true for such a device, and a renderer honours it by hiding what is
personal. The surface itself holds the same thing for every device; what a room hides is the
renderer's decision, because only the consumer knows what is personal in its domain.
A device applies its own move first¶
A device applies a move it makes itself at once, by the same fold the server applies, and then sends it. The person sees the change in the time it takes to draw, not in the time a round trip takes. The server's answer, at a higher version, replaces what was applied locally. If the server refuses the move, the device restores what it held before and reports the refusal.
A say is never applied locally. The device cannot know what the interpreter will make of words, so it waits for the answer.
The newest say wins¶
A device that says twice in quick succession may get the answers out of order. The answer to the newest say is the one held; the answer to an older say, arriving later, is returned to its caller and not held. Nothing blocks the next say while one is in flight.
Staying current¶
A device streams its surface's row over server-sent events and takes a row only when its version is higher than the one it holds. The stream may coalesce versions written close together, and may give the same version twice; neither matters under the version rule.
When the stream ends or drops, the device fetches the surface before it streams again, so a change made while it was away is never missed. The server ends a stream when the view is rebuilt, when the instance is stopping, when it loses the row's listener, or when the device is not reading; the device reconnects after a delay and is given the surface now.
What a renderer is given¶
A renderer is given the surface, the device's class and whether it is in a room, every time the surface the device holds changes, with where the change came from: a fetch, the device's own local move, the server's answer, the stream, or the surface's removal. The device package ships no renderer. Render and steer on a device writes one.