SharedCounter live lab
Complexity IntermediateOpen one room across three tabs or devices. You control one hiker and compare the local notebooks as you exchange updates.
Try a concurrent update
- Create a room. Open its link in two more tabs, or share the link with two other devices. Check that Alice, Bob, and Carol have connected.
- In Alice's tab, send +3. In Bob's tab, send -1. Make both changes before comparing the notebooks.
- From a reset count of 10, all copies should reach 12. Compare the numbered log, then leave and rejoin to replay it.
Reset clears the shared room for all connected hikers. An observer can read the room but cannot edit or reset it.
Storage and recovery
A Cloudflare Durable Object stores this room's shared data in a private SQLite database.
The server stores numbered signed operations. Rejoining replays that log from 10; Reset clears it and restores 10. At 1,000 operations, reset the room before sending more changes.
Closing all tabs does not clear stored data. After a disconnect, rejoin to recover it. There is no persistent offline outbox or automatic reconnect; unconfirmed changes may be lost. Roles identify connections, not accounts. Anyone with the room code can join.
How multiplayer rooms work explains CRDT merging, DDS sequencing, storage lifetimes, and the example database records.