Aleksandar Stojadinovic
Aleksandar Stojadinovic

Reputation: 5049

Sharing SockJS connection

I'm developing a Node.js back-end which communicates with some desktop clients via websockets, and the communication from the server side is initiated from a web front-end. Everything works ok since I am storing the SockJS Connection instances in an array. But if I would like to scale out the service, I guess no such thing would work, I need to share the connections or something like that.

Is there any way to do this, or change my architecture in any way to support the scaling one day?

Upvotes: 0

Views: 682

Answers (1)

mscdex
mscdex

Reputation: 106696

You could scale horizontally by using a load balancer in front of multiple SockJS servers. If you need to share data across multiple SockJS servers, you could use one or more Redis instances (this is what the socket-redis module does).

Upvotes: 1

Related Questions