Skip to content

Commit 452870d

Browse files
author
梁嘉祺
committed
bugfix: node just publish one leave msg on client which joined multi rooms disconnect
1 parent 8441045 commit 452870d

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,10 @@ public void onDisconnect(SocketIOClient client) {
188188
Set<String> joinedRooms = client.getAllRooms();
189189
allClients.remove(client.getSessionId());
190190

191-
leave(getName(), client.getSessionId());
192-
storeFactory.pubSubStore().publish(PubSubType.LEAVE, new JoinLeaveMessage(client.getSessionId(), getName(), getName()));
193-
191+
// client must leave all rooms and publish the leave msg one by one on disconnect.
194192
for (String joinedRoom : joinedRooms) {
195193
leave(roomClients, joinedRoom, client.getSessionId());
194+
storeFactory.pubSubStore().publish(PubSubType.LEAVE, new JoinLeaveMessage(client.getSessionId(), joinedRoom, getName()));
196195
}
197196
clientRooms.remove(client.getSessionId());
198197

0 commit comments

Comments
 (0)