so I'm trying to get send a notification to specific rooms when the user disconnects from socket server. I have this on my server side:
socket.on('disconnect', function() { for (room of socket.rooms) { console.log("Found a room: " + room) //going to try to emit to the rooms the client is connected to here. } console.log("DISCONNECTED USER: " + socket.id); });
This should print out a list of the rooms the socket is currently connected to but when I have the socket join a room and then disconnect, all that prints out is "DISCONNECTED USER: myID." Not entirely sure how to go about this.
https://stackoverflow.com/questions/66876524/how-to-properly-access-the-list-of-rooms-a-socket-is-connected-to-in-socket-io March 31, 2021 at 02:28AM
没有评论:
发表评论