From: Benjamin Auder Date: Thu, 6 Feb 2020 20:41:04 +0000 (+0100) Subject: Bug fix X-Git-Url: https://git.auder.net/doc/html/scripts/pieces/current/assets/rpsls.css?a=commitdiff_plain;h=120fe373ca3b9e83e33bd59979af10fe09350fc5;p=vchess.git Bug fix --- diff --git a/client/src/views/Hall.vue b/client/src/views/Hall.vue index e8f7785f..db8f528b 100644 --- a/client/src/views/Hall.vue +++ b/client/src/views/Hall.vue @@ -447,7 +447,6 @@ export default { } case "connect": case "gconnect": -console.log(data.code + " " + data.from); this.$set(this.people, data.from, {name:"", id:0, gamer:data.code[0]=='g'}); this.st.conn.send(JSON.stringify({code:"askidentity", target:data.from})); if (data.code == "connect") @@ -457,7 +456,6 @@ console.log(data.code + " " + data.from); break; case "disconnect": case "pdisconnect": -console.log(data.code + " " + data.from); this.$delete(this.people, data.from); if (data.code == "disconnect") { diff --git a/server/sockets.js b/server/sockets.js index 553f8c60..75aeadd3 100644 --- a/server/sockets.js +++ b/server/sockets.js @@ -41,10 +41,13 @@ module.exports = function(wss) { switch (obj.code) { case "connect": - notifyRoom(query["page"], "connect"); //Hall or Game - if (query["page"].indexOf("/game/") >= 0) + { + const curPage = clients[sid].page; + notifyRoom(curPage, "connect"); //Hall or Game + if (curPage.indexOf("/game/") >= 0) notifyRoom("/", "gconnect"); //notify main hall break; + } case "pollclients": { const curPage = clients[sid].page; @@ -62,7 +65,6 @@ module.exports = function(wss) { break; case "pagechange": // page change clients[sid].page --> obj.page -console.log(sid + " : page change: " + clients[sid].page + " --> " + obj.page); notifyRoom(clients[sid].page, "disconnect"); if (clients[sid].page.indexOf("/game/") >= 0) notifyRoom("/", "gdisconnect");