]> git.cworth.org Git - empires-server/blobdiff - game.js
Move the keepalive functionality from Empires up to Game
[empires-server] / game.js
diff --git a/game.js b/game.js
index faef43798b79482e4f2e0cdc1656ec66718601c9..ca12fb3e6d302470f5cb1ce946907f3361c50474 100644 (file)
--- a/game.js
+++ b/game.js
@@ -4,6 +4,9 @@ class Game {
     this.id = id;
     this.clients = [];
     this.next_client_id = 1;
+
+    /* Send a comment to every connected client every 15 seconds. */
+    setInterval(() => {this.broadcast_string(":");}, 15000);
   }
 
   /* Suport for game meta-data.
@@ -78,6 +81,10 @@ class Game {
     }
   }
 
+  broadcast_move(move) {
+    this.broadcast_event("move", move);
+  }
+
 }
 
 module.exports = Game;