From fe1738e3d71db883b0c66e344a546ae422c0d291 Mon Sep 17 00:00:00 2001 From: Ben Burlingham Date: Sun, 19 Jul 2020 11:37:09 -0700 Subject: [PATCH] Server-side heartbeat response. --- server/ricochet.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/ricochet.js b/server/ricochet.js index a9d1d6e..5748f19 100644 --- a/server/ricochet.js +++ b/server/ricochet.js @@ -233,6 +233,7 @@ Ricochet.prototype.onMessage = function(ws, rawBody) { } switch (message.type) { + case 'heartbeat': this.msgHeartbeat(ws); break; case 'newround': this.msgNewRound(); break; case 'objective': this.msgObjective(); break; case 'robots': this.msgRobots(); break; @@ -247,6 +248,10 @@ Ricochet.prototype.onMessage = function(ws, rawBody) { }; //===== Message handlers +Ricochet.prototype.msgHeartbeat = function() { + this.messenger.messageOne(ws, { type: 'heartbeat' }); +}; + Ricochet.prototype.msgNewRound = function() { this.objective = this.freshObjective(); this.state = STATE.PLAY;