X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FGame.vue;h=5939c905543ae2ee0586e3e8086c369a64a4ffe9;hp=8fbc9d0b0d90028fe520ccf80e8dd277c471172d;hb=c6788ecf8a595409c7e31febf3d13c97bde2a725;hpb=5c8e044f7bab43ca8573fdf631f9b87daeda3ad0 diff --git a/client/src/views/Game.vue b/client/src/views/Game.vue index 8fbc9d0b..5939c905 100644 --- a/client/src/views/Game.vue +++ b/client/src/views/Game.vue @@ -184,6 +184,19 @@ export default { } break; } + case "askgame": + // Send current (live) game + const myGame = + { + // Minimal game informations: + id: this.game.id, + players: this.game.players.map(p => p.name), + vid: this.game.vid, + timeControl: this.game.timeControl, + }; + this.st.conn.send(JSON.stringify({code:"game", + game:myGame, target:data.from})); + break; case "newmove": // NOTE: this call to play() will trigger processMove() this.$refs["basegame"].play(data.move, @@ -235,12 +248,12 @@ export default { // ==> on "newmove", check "drawOffer" field case "connect": { - this.people.push({name:"", id:0, sid:data.sid}); - this.st.conn.send(JSON.stringify({code:"askidentity", target:data.sid})); + this.people.push({name:"", id:0, sid:data.from}); + this.st.conn.send(JSON.stringify({code:"askidentity", target:data.from})); break; } case "disconnect": - ArrayFun.remove(this.people, p => p.sid == data.sid); + ArrayFun.remove(this.people, p => p.sid == data.from); break; } },