Distributed websocket, how can people hitting different servers communicate with each other?

  node.js, question

Recently, I came into contact with websocket. The demand is very simple. Using websocket, I let users participate in a 1v1 small game.
The environment is distributed deployment, and each server is multi-process. The web server uses nodejs, and the websocket framework uses socket.io.

Problems encountered:
First of all, in a single-server investigation, when using nodejs multi-process (cluster), 400 errors will be reported when establishing a websocket. later, the problem of multi-process is discovered. users cannot guarantee to access the same process every time they visit the server, so the background will report an error of “Session ID unknown”, It may be socket.io must ensure that the front and back offices pass a session id in order to ensure that it may occasionally become long polling. however, every time the page is refreshed, the reinitiation of the websocket should have nothing to do with the websocket before the last refresh. it may also be socket.io introduced session id to ensure reconnection with the server and save resources. I wonder if my understanding is correct.
I looked up a lot of information on the Internet and also saw the recommended scheme (http://socket.io/docs/using-multiple-nodes/) of socket.io website. There are two types:

nginx
By configuring ip_hash, the user can connect to a fixed process every time, and has never played nginx before.

redis
The most established recommendation scheme on the Internet is redis. I did not contact redis before and did not know its operation principle. After understanding it roughly, I found that Redis is a key-value persistent storage, similar to MemCache and mongoDB. The code example given by the website is as follows:

var io = require('socket.io')(3000);
 var redis = require('socket.io-redis');
 io.adapter(redis({ host: 'localhost', port: 6379 }));

The example is very simple, turning the request into an adapter to connect to the redis service, but what is the principle and the scheme of sharing memory? I don’t know much about it, so I didn’t do it either.

In the end, I chose a silly scheme. When starting the websocket service in different subprocesses, I chose different ports. For example, a server with 8 stone will have 8 ports 3001-3008. In this way, when users connect to a fixed port, there will be no 400error. However, after users hit different ports, how to communicate with each other is still a problem. This is only a single server experiment. If it is a cluster, mutual communication is also a problem, and the key is whether users need to connect to the same port and the same server every time? At the end of the day, I still know too little about websocket, and I hope I can get some guidance and help here.

If Redis is used, I guess it is implemented by using Redis’ subscription/publishing function, which can well solve the problem of communication between users on different servers.