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.

This commit is contained in:
Griatch 2011-02-21 18:19:04 +00:00
parent ef59b97881
commit 46ca685c76

View file

@ -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