Answer the question
In order to leave comments, you need to log in
How to implement a complex long-polling (or websocket, it doesn't really matter) node js?
Hello. There is a need to create a complex system of long-polling servers on a node. The following scheme comes to mind
1. Server manager (it receives registration requests to the client and issuing the most unloaded long-polling server to it)
2. The processes of long-polling servers themselves (there can be as many as you like)
And a problem arises. Let's say this picture, the site was visited by user1, user2, user3, user4 and user5. And accordingly, they connected to the issued long-polling servers. user1 created an event - it must be sent to user3, user5; user2 created an event - it must be sent to user4, user1.
Question: how to find out which server the users are connected to, who need to send events, or where it is best to store it. Or, in general, how to implement long-polling on node js on several processes (perhaps servers) in order to distribute the load?
Answer the question
In order to leave comments, you need to log in
1. Server manager- an extra link, the cluster module built into node quite normally solves the problem of balancing within one machine, if there are several machines, then balancing through nginx
And there's a problem- Redis pub/sub or ZeroMQ or RabbitMQ or something like that
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question