2019-09-08
2436
#node
Fernando Doglio
5657
Sep 8, 2019 ⋅ 8 min read

Writing a working chat server in Node

Fernando Doglio Technical Manager at Globant. Author of books and maker of software things. Find me online at fdoglio.com.

Recent posts:

Build a Next.js 16 PWA with true offline support

Learn how to build a Next.js 16 Progressive Web App with true offline support, using IndexedDB, service workers, and sync logic to keep your app usable without a network.

Jude Miracle
Jan 14, 2026 ⋅ 9 min read
replay january 14

The Replay (1/14/26): Deterministic agents, Angular v21, and more

Discover what’s new in The Replay, LogRocket’s newsletter for dev and engineering leaders, in the January 14th issue.

Matt MacCormack
Jan 14, 2026 ⋅ 33 sec read
deterministic AI alexandra spalato

How to build deterministic agentic AI with state machines in n8n

This tutorial explores how to build a robust, state-machine-driven lead qualification system using n8n, a persistent data layer (n8n data tables), and an external CRM (GoHighLevel).

Alexandra Spalato
Jan 14, 2026 ⋅ 5 min read

6 fast (native) alternatives for VSCode

VSCode has architectural performance limits. Compare six fast, native code editors built for lower resource usage.

Shalitha Suranga
Jan 9, 2026 ⋅ 10 min read
View all posts

3 Replies to "Writing a working chat server in Node"

  1. This is a nice breakdown of Socket chat servers. I’m currently doing something similar on a personal project. I also have events emitted when a user sends a friend request, accepts the request, etc.

    Do you recommend storing that Socket instance to user ID map in a service like Redis? I’m thinking of ways to scale up my current implementation.

  2. Hey O. Okeh, thanks for reading!
    In regards to your question, it depends. If what you’re looking for is scaling up to accommodate more users, you need more instances running. +
    I’m assuming you’ve created a dedicated chat service, which you should be able to clone.Then storing session information in Redis will help you more than storing the socket instance-user id map, because that way, your services can remain stateless, and clients can connect to any copy of your service (and any service will have access to the shared memory that Redis represents) without without losing session data.

    So my recommendation would be to use Redis as a shared memory if that is what you need, and keep cloning your chat services with a possible load balancer in front of them.

Leave a Reply

Would you be interested in joining LogRocket's developer community?

Join LogRocket’s Content Advisory Board. You’ll help inform the type of content we create and get access to exclusive meetups, social accreditation, and swag.

Sign up now