views:

46

answers:

1

I am doing comet long polling to retrieve notifications from the server. There is significant delay when requesting new pages quickly. The long poll request is held for 60 seconds. I'm pretty confident cause is that IE7 is waiting for these requests to complete. The delay is gone if I up the MaxConnectionsPerServer value in the registry.

I tried calling abort on the ajax requests on window unload, but that didnt work. I have alerts to make sure that the abort is being called.

What else can I do?

+2  A: 

You are correct, the issue is due to the 2-connection limit in IE.

Your best option is to move the long-held requests to a different domain (or subdomain), which will bypass the connection limits. Taking that idea further, you can use random subdomains with wildcarded DNS to make the solution even better.

Be aware that this has security implications for your code, as all current browsers block cross domain requests by default. Your workarounds will possibly include cross-site HTTP requests, JSONP, and various HTML5 features such as postMessage.

I've described the problem in a bit more detail here.

jvenema
Thanks jvenema, I tried cross-site HTTP requests using JSONP before. It worked flawlessly without SSL. However, most of our client base requires SSL. I had to fall back on using a proxy service within the site's domain. Maybe I'm doing it wrong and JSONP can work with SSL... I'll have to investigate that. Thanks again.
Jeff Z
Also, any idea why calling abort on the request doesn't free up the connection?
Jeff Z
If you actually do abort the request (xhr?) it *should* free things up; but don't forget that it still processes requests in order, so if you have 4 long-held connections open, and you kill one of them, the other 3 would still be blocking. And JSONP can work with SSL just fine, we do it all the time :)
jvenema