I'm creating an online chat on my website.
Almost everything is okay: a client can join a room, he can talk with other clients in the room BUT he can't leave it.
Indeed, when a client try to disconnect a room, it doesn't work.
Here is my server-side code:
io.sockets.on('connection', function (socket) {
// connection
socket.on('room', function(room) {
socket.join(room);
console.log('room join :'+room);
});
// some actions (message, etc)
// disconnection
socket.on('leave', function(room) {
socket.leave(room);
console.log('room quit :'+room);
});
});
I get the "room quit : xxx" in my console but when I try to talk in the room, that still works!
My client can't be disconnected from the room. What goes wrong?