From 731c54ef14f2fdc852961c7c2429117d4e7472d6 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 3 Jun 2020 18:06:39 -0700 Subject: [PATCH] Move the keepalive functionality from Empires up to Game Since TacTacToe, (and any future game), need this too. This keepalive prevents Firefox (at least) from timing out on the server-sent-events stream after the user is idle for two minutes. --- empires.js | 3 --- game.js | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/empires.js b/empires.js index 881a2c0..744224e 100644 --- a/empires.js +++ b/empires.js @@ -38,9 +38,6 @@ class Empires extends Game { this.next_player_id = 1; this.characters_to_reveal = null; this.phase = GamePhase.JOIN; - - /* Send a comment to every connected client every 15 seconds. */ - setInterval(() => {this.broadcast_string(":");}, 15000); } add_spectator(name, session_id) { diff --git a/game.js b/game.js index f1f764f..ca12fb3 100644 --- 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. -- 2.43.0