Answer the question
In order to leave comments, you need to log in
Is it possible to create a global object in SocketCluster?
Hello. Tell me, please, the next moment.
There is a server running on NodeJS. Used in SocketCluster operation. SC has several workers (according to the number of server processors).
The client visiting the page (in fact, a worker is allocated for it), logs in, exchanges data with the server. In the process, you need to create a global object (in my case, an XMPP instance).
Then, when the client opens a new tab of the same page, a new worker is installed for him (but he is already authorized, and the new worker does not know anything about the XMPP instance that has already been created).
How to organize the storage so that the client, being authorized and getting into "any worker", can get exactly the XMPP instance that he needs? It would be possible to put it in exchange, but then all instance methods disappear, only lines remain. Thank you.
Answer the question
In order to leave comments, you need to log in
Move XMPP to a separate microservice and communicate with it by all workers via tcp/http socket.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question