I'm creating a 2-player online game using Node.js with Express and Socket.IO
My task is to create a new room when 1st, 2nd, etc ... rooms are full. From this article I know how to create one room for all connections:
// require everything you need
var io = require('socket.io').listen(server);
io.on('connection',function(socket){
// creating socket.player with unique ID
socket.on('anyeventfromconnectedplayer', function doSomething () {...
});
});
How to create new rooms for new play sessions?
Socket.IO has a mechanism to implement the thing I need but I don't understand how to use it correctly.