From: Benjamin Auder Date: Fri, 28 Jun 2019 16:50:32 +0000 (+0200) Subject: Cosmetics X-Git-Url: https://git.auder.net/variants/Cwda/complete_rules.html?a=commitdiff_plain;h=a36a09c039d2abaa130c7daddd865009f1456bf7;p=vchess.git Cosmetics --- diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index 7d20dbe0..ea5ea365 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -303,8 +303,7 @@ export default { if (!!this.game.oppid) { // Send ping to server (answer pong if players[s] are connected) - this.st.conn.send(JSON.stringify({code:"ping", - target:this.game.oppid, gameId:this.gameRef.id})); + this.st.conn.send(JSON.stringify({code:"ping", target:this.game.oppid})); } }; if (!!game) diff --git a/server/sockets.js b/server/sockets.js index 09434a02..a3f4649a 100644 --- a/server/sockets.js +++ b/server/sockets.js @@ -83,14 +83,13 @@ module.exports = function(wss) { case "newchat": clients[obj.target].send(JSON.stringify({code:"newchat",msg:obj.msg})); break; - // Transmit chats and moves to current room // TODO: WebRTC instead in this case (most demanding?) case "newmove": clients[obj.target].send(JSON.stringify({code:"newmove",move:obj.move})); break; - // TODO: generalize that for several opponents case "ping": - socket.send(JSON.stringify({code:"pong",gameId:obj.gameId})); + // If this code is reached, then obj.target is connected + socket.send(JSON.stringify({code:"pong"})); break; case "lastate": const oppId = obj.target;