Browse Source

bugfix: node just publish one leave msg on client which joined multi rooms disconnect

master
梁嘉祺 5 years ago
parent
commit
452870d6af
  1. 5
      src/main/java/com/corundumstudio/socketio/namespace/Namespace.java

5
src/main/java/com/corundumstudio/socketio/namespace/Namespace.java

@ -188,11 +188,10 @@ public class Namespace implements SocketIONamespace {
Set<String> joinedRooms = client.getAllRooms();
allClients.remove(client.getSessionId());
leave(getName(), client.getSessionId());
storeFactory.pubSubStore().publish(PubSubType.LEAVE, new JoinLeaveMessage(client.getSessionId(), getName(), getName()));
// client must leave all rooms and publish the leave msg one by one on disconnect.
for (String joinedRoom : joinedRooms) {
leave(roomClients, joinedRoom, client.getSessionId());
storeFactory.pubSubStore().publish(PubSubType.LEAVE, new JoinLeaveMessage(client.getSessionId(), joinedRoom, getName()));
}
clientRooms.remove(client.getSessionId());

Loading…
Cancel
Save