Hello i am trying to make a multiplayer game with nodejs and socket.io. I am using multi process socket.io with cluster and socket.io-redis. It works well if you want to broadcast messages, emit etc.
But if i want to add some complexity in my code problems start to appear. I want my game to have a matchmaking function.
Assume this scenario: Server find 2 users that want to play and start a game. Users are on different processes on the same machine. The problem is that a client can communicate with only one process the one that firstly got in. So there are 3 possible solutions as I see it:
- Matchmake with users that is on the same proccess --- Not good.
- Create an ipc method between processes so the one with the target client can broadcast client's answer to the correct process --- Too complex and not sure if solves everything.
- Change client's socket.io process to a new one without the user notice it --- Not sure if this is even possible.
Is there something i am missing here? Is there any other solution that i can't think?
Any help appreciated!