I am trying to solve the following problem: People can connect to a room and every 5 seconds 2 people are randomly selected from this room to start a game (if at least 2 people are in the room). The game is a new room.
So I am joining the people to waiting room with io['client'].join('waitingRoom');
and saving his ID io['client']['id']
to the database (So basically I save a string like 'Dde7Wp41kf0EA3r3AAAA'
in the database).
I have a task which is running every 5 seconds which randomly selects 2 IDs from the database and the problem is that I do not know how to add these 2 IDs in the new 'game'
room. I have only a hash (some string) and not a socket object. Can I do this?