DeepVerse LabSoftware Agency
Loading experience000
DeepVerse Lab
Home/Blog/Backend

Designing real-time chat that scales past 100k sockets

Mehedi Islam
Mehedi Islam30 Sept 2026 · 9 min read
Designing real-time chat that scales past 100k sockets

A single Node process holds thousands of sockets, but production chat needs horizontal scale. The key is making any server able to deliver to any user.

Fan-out with Redis

Each server subscribes to channels for the users connected to it. When a message arrives, it is persisted first, then published; the owning server pushes it down the socket.

io.adapter(createAdapter(pub, sub));
socket.on("msg", async m => {
  await db.messages.insert(m);
  io.to(m.room).emit("msg", m);
});

Persist first, publish second. Never the other way around.

Add delivery receipts and idempotency keys, and the client can safely retry on flaky mobile networks.

Let’s talk

Have a product in mind?

Tell us what you want to build. We reply within 24 hours with a plan, timeline and estimate.

Start a project