In almost every long polling examples I see, there is something like a timeout of 30 seconds client-side. What is the precise reason for this?
Asked
Active
Viewed 2,929 times
5
-
@Mörre What is the problem? (English is not my native language.) – Supercactus Feb 15 '13 at 21:06
-
I have been asking myself the same thing and I could not find an answer. Everybody uses 30 secs without explaining why. Nice to find your question. – silver_mx Mar 10 '19 at 01:29
1 Answers
5
Some routers, proxies or whatever device there is in the middle might decide to drop TCP/IP connections being idle for extensive period of time. Also refreshing connection once in a while makes sure you'll discover server failure quicker.

Tomasz Nurkiewicz
- 334,321
- 69
- 703
- 674
-
Thanks for your answer. So, XMLHttpRequest's readyState does not change when a TCP connection is dropped? – Supercactus Feb 15 '13 at 21:11
-
@Supercactus: it should if remote server/OS closes the connection. But if you simply cut off the network cable, you might not be notified. – Tomasz Nurkiewicz Feb 15 '13 at 21:14