What safe amount of time can I wait before answering the browser without getting a timeout?

I am creating a chat application that works with a long poll to emulate push from server to client.

Basically, the browser asks for updates, and I respond if there is something new. Otherwise, I keep the connection open without responding until something appears that needs to be sent back.

Now, if 30 seconds have passed and I didn’t send anything, I send a response, saying mostly “NoNews”, and the client will poll again.

What I want to do, obviously, supports this unanswered connection for as long as possible before the browser just shuts down and surrenders to me ... I did not find any good documentation about client timeout for each browser, and this does not look like the same for all of them ...

Have any of you applied for a lengthy survey?
Any ideas what could be the longest secure timeout?

Thanks!

+5
source share
2 answers

The browser should detect a timeout on XHR and make another request.

Update:

Detecting timeouts on the XHR is actually complicated, because for some reason it is not built-in. Of course, you will also have to handle 502/503 answers, etc.

+2

- . , IE,

Internet Explorer 4.0 and Internet Explorer 4.01 - 5 minutes
Internet Explorer 5.x and Internet Explorer 6.x - 60 minutes
Internet Explorer 7 and Internet Explorer 8 - 60 minutes

, .

- - . , , . - , LONGEST . - - , , .

, ,

HTTP- J2ME

, AJAX. , , , , - .

+1

All Articles