Web2.0 Reconnections

I had some trouble with this early on and wrote a little JavaScript method to check for disconnects and reload the page when the server came back up. It uses a 10 second timeout, which can be changed in the last JS line. Put this in Session.Opening:

var exec() as String
exec.Add( "setInterval(function() {" )
exec.Add( "  if ($('#dialog_disconnect').length > 0 || $('#dialog_reconnect').length > 0) {" )
exec.add( "    $.ajax({url : window.location.href}).done(function(data, statusText, xhr) {" )
exec.add( "      if (xhr.status == 200) location.reload();" )
exec.Add( "    });" )
exec.Add( "  }" )
exec.Add( "}, 10000);" )
ExecuteJavaScript( String.FromArray( exec, "" ) )

Hope it helps. I haven’t used or tested it in a long while now.

1 Like