Pergunta

It's a basic question: Is there any time limit (timeout) for the connection of a browser to a webserver (and vice versa)?

Example: Some ticket services are offering a waiting list system. If you open a specific ticket buying website you will be at the end of the waiting list until the visitors in front of you have ordered their tickets. At this time you see a "waiting website". However, if you are at the front of the waiting list the server has to send you a "signal" and you should now see a formula where you can order the tickets. My personal experience in this case is, that some browser lose the connection to the server after several minutes (10? 15? 30?). In result, you will never see the website to order the tickets, you will see the "waiting website" all day long.

Foi útil?

Solução

You cannot, when dealing with a general audience over public networks, rely on any timeout longer than zero for maintaining a browser to server connection.

You just can't.

HTTP 1.0, which is still in use here and there, calls for browsers to send requests to web servers. The web servers respond and immediately close their connections.

HTTP 1.1, which is gaining in popularity, calls for browsers to send requests to web servers. The web servers then respond, and also specify a keepalive time. The browser can then re-use the connection to the web server for followup requests (like png images on the page). But the server can still arbitrarily drop the connection.

Browsers always initiate connections to web servers. Servers cannot initiate connections to browsers. Many browsers are behind routers that do network address translation.

In all standard cases, the browser must initiate connections to the server. You'll need to use AJAX-style browser javascript or an http refresh tag in your web app to get the user's browser to try again. See here for a writeup on refresh. http://en.wikipedia.org/wiki/Meta_refresh

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top