views:

141

answers:

3

I need to maintain multiple active long-pooling AJAX connections to the Webserver.

I know that most browsers don't allow more then 2 simultaneous connections to the same server. This is what the HTTP 1.1 protocol states:

Clients that use persistent connections SHOULD limit the number of simultaneous connections that they maintain to a given server. A single-user client SHOULD NOT maintain more than 2 connections with any server or proxy. A proxy SHOULD use up to 2*N connections to another server or proxy, where N is the number of simultaneously active users. These guidelines are intended to improve HTTP response times and avoid congestion.

Supposing that I have 2 sub-domains Server1.MyWebSite.Com and Server2.MyWebSite.Com sharing the same IP address, will I be able to make 2x2 simultaneous connections?

A: 

It will be 100% browser dependent. Some might base the 2 connection limit on domain name, some might on IP address.

Others will let you do as many as you like.

Randolpho
+1  A: 

It does appear that different hostnames on the same IP can be useful. You may run into issues when making the AJAX connections due to Same Origin Policy.

Edit: As per your document.domain question (from Google's Browser Security Handbook):

Checks for XMLHttpRequest targets do not take document.domain into account...

shambleh
Would something like this solve the prb ?document.domain = "MyWebsite.
Lotfi
A: 

No browser bases its connection limit on IP address. All browsers base the limit on the specified FQDN.

Hence, yes, it would be entirely fine to have a DNS alias to your server, although the earlier answer is correct that XHR will require that you use the page's domain name for XHR, and use the alias to download the static content (images, etc) in the page.

Incidentally, modern browsers typically raise the connection limit to 6 or 8 connections per host.

EricLaw -MSFT-