Joining socket io room on connect

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);

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)