Connection Timeout Extension/Detection

Posted by ircmaxell on Stack Overflow See other posts from Stack Overflow or by ircmaxell
Published on 2010-05-24T19:04:51Z Indexed on 2010/05/24 19:41 UTC
Read the original article Hit count: 227

Filed under:
|
|
|

Well, let me start off by explaining what I'm trying to do. I have an application that stalls a HTTP connection until new data is available (sometimes a few seconds, sometimes 30 minutes or so). Right now, the system works fine if the data is sent within a few minutes.

The problem I'm facing, is that it doesn't seem that XHR recognizes a dropped connection... So instead of killing the current connection and reconnecting when it detects a dropped connection, it just sits there. I'd really not like to have it force-reconnect every minute or two (That's one reason this app was written, to stop the need for polling).

So, my questions are as follows:

  1. Is there a way to detect a dropped (not closed) TCP connection with XHR?
  2. Is there a way that I can tell XHR not to timeout (I saw IE8 has the .timeout property)
  3. Would it be better to send a header (or some other content) every now and then (say once per minute) down the pipe to keep the connection open?

Thanks.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about timeout