Some interesting reading if you want to go deeper:
Ellis & Gibbs (1989), "Concurrency Control in Groupware Systems" β the paper that introduced OT: https://t.co/QgU42AtVuJ
ShareDB β a realtime database that syncs JSON documents using OT: https://t.co/2ECf5tZeNO
When two people type in the same Google Doc, their edits race each other over the network, yet every screen ends up with identical text.
The algorithm behind this is Operational Transformation (OT), first published in 1989.
Here's how it works π§΅
Clients transform too.
While your op is in flight (sent, not yet acknowledged), a remote op can arrive. The client transforms its pending op against the remote one, so the local screen stays consistent without waiting for the server round-trip.
rrweb is one instance of a broader pattern: record a baseline once, then a sequence of changes, and you can reconstruct any point in time. The same idea drives undo/redo and time-travel debuggers. rrweb is open source if you want to read how it's done:
https://t.co/8HfNWrBFZS
I always wondered how session replay tools like PostHog, Sentry, and LogRocket play back what a user did on a page, so I dug in.
They mostly don't record the screen as video. Tools like rrweb record the DOM and reconstruct it. Here's how.
π§΅
Recording data rather than pixels has a few practical effects: the recording is small (kilobytes of JSON instead of megabytes of video), the replay is a real DOM you can inspect and query.