Chad Johnson
Chad Johnson

Reputation: 21895

Architecture for XMPP-based chat service using web sockets

Let's say I want to create a web and web socket-based chat service. And let's also say that I want multiple, discrete chat rooms.

I need this to scale, so, I'm thinking to use XMPP so that I can transparently use multiple servers. Is the architecture shown in the diagram what I would need?

enter image description here

And, would I even need NodeJS?

Upvotes: 4

Views: 2491

Answers (1)

Raynos
Raynos

Reputation: 169373

How about a node.js load balancer and multiple node.js servers behind it.

use something like redis to store the data and handle message passing. See this article

Then each client lives on a node.js server, you don't care which.

Each message get's handled by a node.js server (you don't care which).

Every message gets send into redis by the node.js server that handles that incoming message.

Then each node.js server picks it up and pushes it to all clients connected to that server and that chat room.

You'll need a bit of black magic to pipe messages from the single socket.io connection on your load balancer into tcp sockets of your multiple node.js servers.

Upvotes: 2

Related Questions