From a36a09c039d2abaa130c7daddd865009f1456bf7 Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Fri, 28 Jun 2019 18:50:32 +0200 Subject: [PATCH] Cosmetics --- client/src/views/Game.vue | 3 +-- server/sockets.js | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) 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; -- 2.44.0