From 46ca685c76d3b81184bed0f5c0362bf92978eba2 Mon Sep 17 00:00:00 2001 From: Griatch Date: Mon, 21 Feb 2011 18:19:04 +0000 Subject: [PATCH] Made an "idle" command to be sent from the webclient to the server every 3 minutes to avoid conservative reverse proxies resetting connections on us. This should fix issue 129. --- src/web/media/javascript/evennia_webclient.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/web/media/javascript/evennia_webclient.js b/src/web/media/javascript/evennia_webclient.js index 5b969c407a..d81c89437c 100644 --- a/src/web/media/javascript/evennia_webclient.js +++ b/src/web/media/javascript/evennia_webclient.js @@ -65,10 +65,10 @@ function webclient_receive(){ }); }; -function webclient_input(){ +function webclient_input(arg){ // Send an input from the player to the server - - var outmsg = $("#inputfield").val(); // get data from form + + var outmsg = typeof(arg) != 'undefined' ? arg : $("#inputfield").val(); $.ajax({ type: "POST", @@ -229,6 +229,7 @@ function webclient_set_sizes() { //$("#inputfield").css({'width': win_w - inp_w - 20}); } + // Callback function - called when page has finished loading (gets things going) $(document).ready(function(){ // remove the "no javascript" warning, since we obviously have javascript @@ -239,6 +240,10 @@ $(document).ready(function(){ setTimeout(function () { webclient_init(); }, 500); + // set an idle timer to avoid proxy servers to time out on us (every 3 minutes) + setInterval(function() { + webclient_input("idle"); + }, 60000*3); }); // Callback function - called when the browser window resizes