home · contact · privacy
Add PING.
[plomrogue2-experiments] / new2 / rogue_chat.html
index 7ba548b119f19cfaf74b373faed4084ea2ba0548..dd0036ec7f8e47ce90c455b7be1a721bf9bc2af5 100644 (file)
@@ -230,10 +230,14 @@ websocket.onmessage = function (event) {
      tui.log_msg('game error: ' + tokens[1]);
   } else if (tokens[0] === 'GAME_ERROR') {
      tui.log_msg('game error: ' + tokens[1]);
+  } else if (tokens[0] === 'PONG') {
+    console.log('PONG');
   } else {
      tui.log_msg('unhandled input: ' + event.data);
   }
 }
+
+window.setInterval(function() { websocket.send('PING') }, 30000);
 </script>
 </body>
 </html>