How can I emit to a specific room in disconnect handler? #1743
-
I try to detect the disconnection of the clients and inform it to all the clients in the room. The server should handle the disconnection event and emit an announcement event back to all other clients that are in the same room. Then I write a disconnect hander on the server-side:
On the client-side, I write a handler for the 'disconnect_announcement' event and add the disconnection information to $messages:
As a result, if I emit the 'disconnect_announcement' event with |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Is the value of |
Beta Was this translation helpful? Give feedback.
Is the value of
session.get('roomid')
correct? Can you show me what your terminal shows for theprint
statement you have in the disconnect handler?