I am trying to make a logged in user to join a certain socket.io room on connect. According to any examples I found on the net I seem to have emit some action from client to be able to join some room. Something like:
socket.on('connect', function() {
socket.emit('join', 'room1');
});
Server.js:
io.sockets.on('connection', function(socket) {
socket.on('join', function(room) {
socket.join(room);
});
});
And according to most tutorials it should work.
What I am thinkin to do is to:
socket.on('connect', function() {
socket.join('room1');
});
But It does not seem to work as whatever msg I emit from server are not caught on client. Any idea, what am I doing wrong? Is it possible in general?