Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/puskar-roy/scaleable-chat-app

Scaleable Chat App Using Typescript, Node.js, Express Js, Socket.IO, Redis, Pub/sub
https://github.com/puskar-roy/scaleable-chat-app

expressjs nextjs14 nodejs pubsub redis socket-io typescript

Last synced: about 1 month ago
JSON representation

Scaleable Chat App Using Typescript, Node.js, Express Js, Socket.IO, Redis, Pub/sub

Awesome Lists containing this project

README

        

# Upscaling Node.js + Socket.IO Server 🚀

When scaling a Node.js + Socket.IO server, you might encounter several issues related to maintaining user connections and state consistency across multiple server instances. This document outlines common problems and provides solutions for effectively scaling your Socket.IO server.

### Issues 😧

## User Connections Across Multiple Servers 📥

### Problem

When you scale horizontally by creating multiple server instances, users may get connected to different servers. This fragmentation can disrupt real-time communication as users connected to different instances cannot interact with each other seamlessly

![server](./docs/assets/socket-server-problem.png)

### Solution

Use a message broker like Redis to share connection information and state across all server instances. This ensures that messages and events are broadcasted to all users, regardless of the server instance they are connected to.