This should be what you need. Feel free to pass in whatever room name you want through the client. Only the server can handle assigning a socket to a room.
Server:
io.sockets.on('connection', function(socket) {
socket.on('join', function(room) {
socket.join(room);
});
});
Client:
socket.emit('join', roomNum);