Handling Real-Time State: How Trello Syncs Boards Across Clients
Explore how Trello uses WebSockets and a Pub/Sub model to synchronize board states in real-time, utilizing optimistic UI updates to minimize perceived latency.
06 Aug 2026, 00:07 UTC

The Challenge of the Shared Board
When multiple team members collaborate on a single Trello board, the primary technical challenge is maintaining a consistent state without forcing users to refresh their browsers. If User A moves a card from 'To Do' to 'Done,' User B needs to see that movement instantly to avoid duplicating work or editing stale data. The takeaway for engineers is that achieving this requires moving away from request-response cycles toward a persistent, event-driven architecture.
Moving Beyond HTTP Polling
Traditional web applications use HTTP polling, where the client asks the server for updates every few seconds. At Trello's scale, this would create massive server overhead and introduce a lag between the action and the update. Instead, Trello employs WebSockets—a protocol that provides a full-duplex communication channel over a single TCP connection.
Once a user opens a board, a WebSocket connection is established. This allows the server to push data to the client the moment a change occurs, rather than waiting for the client to ask. This shift reduces latency and minimizes the number of HTTP headers sent back and forth, making the interface feel like a desktop application.
The Pub/Sub Distribution Model
To manage which updates go to which users, Trello utilizes a Publish/Subscribe (Pub/Sub) pattern. In this model, each board acts as a specific "channel."
- Publish: When a user updates a card, the client sends the change to the server. The server then "publishes" this event to the board's specific channel.
- Subscribe: Every client currently viewing that board is "subscribed" to that channel. The server broadcasts the update to all active subscribers simultaneously.
This ensures that the server doesn't have to track every individual user's state manually; it simply pushes the event to the channel, and the WebSocket layer handles the delivery to the connected clients.
Optimistic UI and State Merging
To eliminate the perception of network lag, Trello uses Optimistic UI updates. When you drag a card, the card moves on your screen immediately, before the server has even acknowledged the request. The client assumes the operation will succeed.
If the server confirms the move, the state is finalized. If the server rejects the change (e.g., due to a permissions error), the client must "roll back" the card to its original position. This requires a robust client-side state management system that can merge incoming WebSocket events into the existing DOM without triggering a full page reload, which would disrupt the user's flow.
Diagnostic Example: Monitoring the Sync
You can observe this architecture in action using browser developer tools. This is a useful way to verify if a network issue is blocking real-time updates.
- Open a Trello board in two separate browser windows side-by-side.
- In one window, right-click and select Inspect, then navigate to the Network tab.
- Filter the network traffic by WS (WebSockets).
- Perform an action, such as moving a card or adding a comment.
- Observe the Messages sub-tab within the WebSocket connection. You will see data frames being sent (the action) and received (the confirmation and broadcast to other clients).
Trade-offs and Limitations
This architecture is not without risks. One significant limitation is the "Event Storm." On extremely active boards with dozens of users making rapid changes, the volume of WebSocket messages can overwhelm the client's browser, leading to UI stuttering or high CPU usage.
Additionally, Trello generally employs a "Last-Write-Wins" resolution strategy for race conditions. If two users edit the same text field at the exact same millisecond, the update that reaches the server last will overwrite the previous one. For high-precision data, this is a risk, but for project management, it is a pragmatic trade-off for system speed.
Verification Summary
To verify your environment supports this real-time flow, ensure that your network or firewall allows persistent WebSocket connections. If cards only update after a manual refresh, the WebSocket handshake is likely being blocked by a proxy or security appliance.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.