Skip to content

Commit

Permalink
bugfix: node just publish one leave msg on client which joined multi …
Browse files Browse the repository at this point in the history
…rooms disconnect
  • Loading branch information
梁嘉祺 committed Aug 11, 2020
1 parent 8441045 commit 452870d
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,10 @@ public void onDisconnect(SocketIOClient client) {
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());

Expand Down

0 comments on commit 452870d

Please sign in to comment.