Practise vocabulary for real-time collaboration: presence indicators, live cursors, CRDTs, operational transformation, and conflict resolution strategies.
0 / 5 completed
1 / 5
A collaborative editor shows each user's cursor position in real time. What is this feature called and what is the key engineering challenge?
Live cursors are a presence feature: each client broadcasts its cursor position over a WebSocket channel; all other clients render the received positions as coloured cursors with the user's name. Key challenges: (1) throttling — broadcasting on every mouse-move event floods the server; typical approach is throttle to 50ms intervals. (2) Interpolation — smooth cursor movement on the receiver side despite network jitter. (3) Cleanup — removing a cursor when a user disconnects.
2 / 5
What are CRDTs (Conflict-free Replicated Data Types) in the context of real-time collaborative editing?
CRDTs (e.g., Yjs, Automerge) are algebraic data structures with a merge function that is commutative, associative, and idempotent — meaning any two states can be merged in any order and the result is always consistent. For collaborative text editing, a CRDT assigns each character a globally unique position so that concurrent inserts from two users always produce a deterministic merged result without a server making the decision. CRDTs enable fully distributed collaboration (peer-to-peer sync) and offline editing with eventual consistency.
3 / 5
What is Operational Transformation (OT) and how does it differ from CRDTs for collaborative editing?
Operational Transformation (the technology behind early Google Docs and Wave) works by transforming incoming operations against all concurrent operations that have already been applied locally. If user A inserts at position 5 while user B deletes at position 3, OT adjusts A's insert to position 4 before applying it. OT requires a central authority to serialize operations. CRDTs avoid this by using position identifiers that don't need transformation — enabling decentralized sync. Both produce correct results; CRDTs are generally considered simpler to implement correctly.
4 / 5
What does 'last write wins' (LWW) mean as a conflict resolution strategy, and when is it appropriate?
Last Write Wins (LWW) is used for eventually-consistent key-value data where losing a concurrent update is acceptable: cursor positions, presence status, user settings. It is NOT appropriate for collaborative text editing — if two users both edit a paragraph simultaneously, LWW would silently discard one user's changes. For text, CRDTs or OT are required. In distributed databases (Cassandra, Redis), LWW is a common default conflict resolution strategy with the understanding that data loss is possible under concurrent writes.
5 / 5
What is a 'presence indicator' in real-time collaboration vocabulary?
Presence indicators show awareness: 'Alice and Bob are also viewing this document right now.' Implementation: when a client connects, it broadcasts a 'joined' event with user metadata; the server tracks all connected users and broadcasts the current presence list to new joiners; on disconnect (or heartbeat timeout), a 'left' event is emitted. Tools like Liveblocks, PartyKit, and Ably provide managed presence channels. Presence data is ephemeral — not stored in the database, only in the connection layer.