X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=server%2Fsockets.js;h=127b7fa1b2a6995fc20e882ccc0a0f61d9091652;hb=93d1d7a7e07e7bad94318d3cb4cbe906d85bd811;hp=f3d1928db9f73d5ff1ba9fb73be2d05e7f5cf56b;hpb=5bd05dba30fc83821637b6f3f080ca72da4bb157;p=vchess.git diff --git a/server/sockets.js b/server/sockets.js index f3d1928d..127b7fa1 100644 --- a/server/sockets.js +++ b/server/sockets.js @@ -83,6 +83,10 @@ module.exports = function(wss) { clients[obj.target].send( JSON.stringify({code:"refusechallenge", cid:obj.cid, from:sid})); break; + case "deletechallenge": + clients[obj.target].send( + JSON.stringify({code:"deletechallenge", cid:obj.cid, from:sid})); + break; case "newgame": clients[obj.target].send(JSON.stringify( {code:"newgame", gameInfo:obj.gameInfo, cid:obj.cid})); @@ -107,13 +111,9 @@ module.exports = function(wss) { obj.oppid = sid; //I'm the opponent of my opponent(s) clients[oppId].send(JSON.stringify(obj)); break; - // TODO: moreover, here, game info should be sent (through challenge; not stored here) - // TODO: also other challenge events case "resign": clients[obj.target].send(JSON.stringify({code:"resign"})); break; - // TODO: case "challenge" (get ID) --> send to all, "acceptchallenge" (with ID) --> send to all, "cancelchallenge" --> send to all - // also, "sendgame" (give current game info, if any) --> to new connections, "sendchallenges" (same for challenges) --> to new connections } }); socket.on("close", () => {