From: Carl Worth Date: Sun, 10 May 2020 15:40:14 +0000 (-0700) Subject: Send a comment to every connected client every 15 seconds X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=0d23b6be462bcdbad9e20b35d78580e78bd7f4ea;p=empires-server 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. --- 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) {