+ case "duplicate":
+ // Turn off message listening, and send disconnect if needed:
+ socket.removeListener("message", messageListener);
+ socket.removeListener("close", closeListener);
+ // From obj.page to clients[sid].page (TODO: unclear)
+ if (clients[sid].page != obj.page)
+ {
+ notifyRoom(obj.page, "disconnect");
+ if (obj.page.indexOf("/game/") >= 0)
+ notifyRoom("/", "gdisconnect");
+ }
+ break;
+ // Wait for "connect" message to notify connection to the room,
+ // because if game loading is slow the message listener might
+ // not be ready too early.