I'm still getting messages even after leave the room.
See original GitHub issueHi all
I’m still getting messages even after leave the room.
Here is the server code.
io.sockets.on( 'connection', function( socket ) {
console.log('received connection signal');
//join chat room
socket.on('join', function(user, room) {
socket.join(room);
socket.user = user;
socket.room = room;
console.log(user + " Joined the room: "+ room);
});
//leave the chat room
socket.on('leave', function(user, room) {
socket.room = '';
console.log(user + " left the room: "+ room);
socket.broadcast.to(room).emit('disconnected', user, room, 'disconnected');
socket.leave(room);
});
});
server.listen(port, function() {
console.log('Express server listening on %d', port)
});
Can you point me the issue?
Thanks.
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (4 by maintainers)
Top Results From Across the Web
Why do I not get my texts until I walk th… - Apple Community
I text my husband at work, but he doesn't get any of them until he walks through the door at home. Then his...
Read more >Fix problems sending, receiving or connecting to Messages
If you can't send or receive messages, or have trouble connecting to Messages on web, try the following suggestions below. Fix problems sending...
Read more >What Happens to Texts When Do Not Disturb Is On
Yes, you will continue receiving texts. Do Not Disturb mode on iOS and Android prevents notifications from making noise or appearing on screen....
Read more >Did You Receive a Text Message From Yourself? You're Not ...
“Spam texts are just increasing at a much more drastic rate than spam calls.” Here's what to look out for with text scams...
Read more >Socket.io user still receiving messages after disconnection
I was sending an event to leave and rejoin the same room because I set the variable pastRoom equal the the same as...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You should use the callback argument of leave:
@EddieOne could you please provide a sample project reproducing the issue please?