Ana types, Ben sees it
Every editor of a document ends up connected to the one server that holds it, so each edit passes through one place.
- Ana's editor shows her word at once and sends the edit over its WebSocket to a gateway.
- The gateway forwards it to the document's server, found by document id.
- The server saves the edit and acknowledges it to Ana.
- It pushes the edit to every other connection on the document; Ben's editor applies it.
Diagram as text
Components: Ana's editor (Client); Gateway (API gateway); Document server (Service); Edit log (NoSQL DB); Ben's editor (Client); Gateway (API gateway). Connections: Ana's editor → Gateway (1. edit (shown at once)); Gateway → Document server (2. by document id); Document server → Edit log (3. save); Document server → Gateway (4. push to the others); Gateway → Ben's editor (5. apply).
Read:Learn: Real-time delivery architectureLearn: Protocols and real-time transports
Keep reading+1 min
Finding the document’s server
A routing table in a consensus store, or consistent hashing on the document id, tells a gateway which server holds a document. Gateways stay stateless, so they can be added freely; document servers move documents between them with a handoff.
Check yourself
Ana and Ben are connected to different gateways. How does her word reach him?
Show answerHide answer