Server-side heartbeat response.

master
Ben Burlingham 5 years ago
parent 1fc4479c18
commit fe1738e3d7
  1. 5
      server/ricochet.js

@ -233,6 +233,7 @@ Ricochet.prototype.onMessage = function(ws, rawBody) {
} }
switch (message.type) { switch (message.type) {
case 'heartbeat': this.msgHeartbeat(ws); break;
case 'newround': this.msgNewRound(); break; case 'newround': this.msgNewRound(); break;
case 'objective': this.msgObjective(); break; case 'objective': this.msgObjective(); break;
case 'robots': this.msgRobots(); break; case 'robots': this.msgRobots(); break;
@ -247,6 +248,10 @@ Ricochet.prototype.onMessage = function(ws, rawBody) {
}; };
//===== Message handlers //===== Message handlers
Ricochet.prototype.msgHeartbeat = function() {
this.messenger.messageOne(ws, { type: 'heartbeat' });
};
Ricochet.prototype.msgNewRound = function() { Ricochet.prototype.msgNewRound = function() {
this.objective = this.freshObjective(); this.objective = this.freshObjective();
this.state = STATE.PLAY; this.state = STATE.PLAY;

Loading…
Cancel
Save