00
%
Infrastructure
Case study
A horizontally scalable WebSocket system where multiple server instances coordinate through Redis and RabbitMQ for real-time cross-server messaging.
Project
Industry
Year
Role
With a single server, WebSocket messaging is straightforward: keep a map of open connections, look up the recipient, and write to their socket.
That breaks as soon as you run more than one instance for load balancing or availability. Server 1 has no idea which users are connected to Server 2, so a message from a user on one server to a user on another simply never arrives.
Each server keeps its own local connections, and two shared services let the servers cooperate without knowing about each other directly.
When a user on Server 1 messages a user on Server 2, Server 1 first checks its own connections. When the recipient is not there, it asks Redis which server they are on, then publishes the message to RabbitMQ with that server's routing key. Server 2 receives it on its queue, finds the recipient among its local connections, and writes it to their socket.
Every frame records where it came from and how it was delivered (from_server, to_server, and a route of local or rabbitmq), and the sender receives an acknowledgement, or an error if the recipient is offline.
Users connected to different instances can message each other as if there were a single server, and the WebSocket code stays close to a single-server version. The live demo puts two people in a room, one on each server, and shows the route every message takes: from one server, through RabbitMQ, to the other.

An AI-powered video processing API that detects high-impact moments in fight videos and applies dramatic visual effects automatically.
Next project