From 0d23b6be462bcdbad9e20b35d78580e78bd7f4ea Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Sun, 10 May 2020 08:40:14 -0700 Subject: [PATCH] Send a comment to every connected client every 15 seconds This prevents timeouts when the client receives nothing from the server. For example, firefox appeares to give up on the server when it receives nothing for two minutes. --- server.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server.js b/server.js index deb0b9c..7a13837 100644 --- a/server.js +++ b/server.js @@ -11,6 +11,9 @@ class Game { this.next_player_id = 1; this.clients = []; this.next_client_id = 1; + + /* Send a comment to every connected client every 15 seconds. */ + setInterval(() => {this.broadcast_string(":");}, 15000); } add_player(name, character) { -- 2.43.0