NodeJs Primus failOver

57 Views Asked by At

I have one app that uses primus to connect using websockets.

I am in pursuit of making it redundant so the goal is that the client is connected to the websocket on node X and I have node Y on the server as the slave. How can I shutdown node X and without user notice it, connect his websocket to node Y?

I mean, suppose there is something on the backend processing. Meanwhile the client disconnects from node X and connects to node Y. I must have some logic to know that, that specific spark is from that client and then, when the processing end, I can send the reply to the client.

I have one MongoDb instance that will share data between the nodes, but I don´t know what data. I tried to save the spark, but I can´t since it has object methods.

Any help appreciated.

0

There are 0 best solutions below