Refactor endgame process, start working on game end (abort)
[vchess.git] / server / sockets.js
index e94f623..274d70a 100644 (file)
@@ -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}));
@@ -110,6 +114,9 @@ module.exports = function(wss) {
         case "resign":
           clients[obj.target].send(JSON.stringify({code:"resign"}));
           break;
+        case "abort":
+          clients[obj.target].send(JSON.stringify({code:"abort",msg:obj.msg}));
+          break;
       }
     });
     socket.on("close", () => {