Blog 12 — Figma: How Multiplayer Technology Works
C
Qubits of DPK
March 21, 2026
Core Case Studies
Core Concept: WebSockets vs Long Polling vs SSE, CRDT (Conflict-free Replicated Data Type), Real-time conflict resolution
Why SDE-2 Critical: Real-time collab is a separate skill set — knowing CRDT separates you from 90% of candidates
Status: Draft notes ready
Quick Revision
- Problem: Multiple people edit the same object concurrently.
- Core pattern: WebSockets, optimistic local updates, and CRDT-style reconciliation.
- Interview one-liner: Real-time collaboration is about converging state without blocking users.
️ The Core Problem
javascript
QUBITS OF DPK
Core Concepts
WebSockets vs Long Polling vs SSE
javascript
QUBITS OF DPK
Operational Transformation (Old Approach — Google Docs)
javascript
QUBITS OF DPK
CRDT — Conflict-free Replicated Data Type
javascript
QUBITS OF DPK
Figma's Actual Architecture
javascript
QUBITS OF DPK
Scale Achieved
5 Interview Questions This Blog Unlocks
Q1. Design Google Docs / collaborative editing
Answer: WebSockets for bidirectional real-time communication. CRDT or OT for conflict resolution. Optimistic local updates for responsiveness. Server as source of truth — broadcasts operations to all clients. Operation log for reconnection recovery. Presence indicators via heartbeat messages.
Q2. What is the difference between WebSockets and HTTP?
Answer: HTTP is request-response — client must initiate every communication. WebSocket is persistent bidirectional — server can push data anytime. HTTP: new TCP connection per request (overhead). WebSocket: one TCP connection maintained. For real-time features, WebSocket latency is 10x lower.
Q3. What is CRDT and why is it better than locking for collaboration?
Answer: CRDT = data structure where concurrent operations always merge to the same result without coordination. No locks needed. Alice and Bob can both edit offline → sync later → guaranteed consistent merge. Locking would block one user while other edits — terrible UX for collaboration.
Q4. What is optimistic UI update and what's the risk?
Answer: Apply operation locally before server confirms. UI feels instant. Risk: server might reject/transform the operation. Solution: server sends back canonical state, client reconciles (OT/CRDT handles this). Trade-off: occasional visible cursor jump vs waiting 100ms for every keystroke.
Q5. How does Figma handle a user who disconnects and reconnects?
Answer: Server maintains an operation log per document. On reconnect, client sends its last known sequence number. Server replays all operations since that sequence number. Client applies them in order. Result: seamless sync to current state as if never disconnected.