What is CRDT (Conflict-free Replicated Data Type) and how does it apply to real-time collaboration?
Answer
CRDTs are data structures designed to be replicated across multiple nodes where updates can be made concurrently without coordination, and all replicas eventually converge to the same state — without requiring a central authority to resolve conflicts. Types: G-Counter (grow-only counter), LWW-Register (last-write-wins), RGA/LSEQ (ordered lists for collaborative text editing). In real-time collaborative applications (Google Docs, Figma, Notion), CRDTs enable offline editing — users can edit without a server connection, and changes merge deterministically when they reconnect. The Yjs library implements CRDT-based shared data types (Y.Text, Y.Map, Y.Array) and integrates with WebSocket providers (y-websocket) to sync state across clients. Unlike Operational Transformation (OT, used by Google Docs's older system), CRDTs don't require a central server to transform operations — all replicas can merge directly. Automerge is another popular CRDT library.
Previous
How do you handle WebSocket connections in a Kubernetes environment?
Next
How do you implement rate limiting for WebSocket connections?
More WebSockets & Real-time Questions
View all →- Advanced How do you scale WebSocket servers horizontally?
- Advanced What is the difference between WebSockets and WebRTC?
- Advanced How do you implement end-to-end encryption over WebSockets?
- Advanced What is the actor model and how does it apply to real-time systems?
- Advanced How do you handle WebSocket connections in a Kubernetes environment?