目次

Version 1, last updated by lkuczera at Nov 02 05:28 UTC

One of common questions asked is how does Lift handle long connections? Especially when we have like CISCO routers, proxy servers between that likely kill it when is inactive.

If the connection is lost for any reason, the browser will restart the long poll. The comet request timeout defaults to 120 seconds (LiftRules.cometRequestTimeout). If there's no change during that 120 seconds, a "Noop" is sent to the browser and the browser waits 100 milliseconds and restarts the long polling operation.

It's very unlikely that a router will shut down the TCP/IP connection between the client and the server. HTTP Keep-Alive is a very popular mechanism for improving browser performance (the TCP/IP connection to port 80 or 443 is kept open even after the HTTP request is done to avoid TCP/IP set-up time.) Most routers that have been made in the last 10-12 years are aware that HTTP connections may be kept alive for extended periods of time.

It's more likely that a proxy in between the browser and the Lift-based server will drop the connection. Apache-based proxies have a very limited number of open connections they can handle and they will often close a connection (traffic or no) after 30 seconds. But this makes no difference to Lift or the browser... they happily re-open the long poll and go on.