2

I am trying to use a COMET solution using ASP.NET .

Trouble is I want to implement sending and notification part in the same page. On IE7, whenever I try to send a request, it just gets queued up. After reading on internet and stackoverflow pages I found that I can only do 2 simultaneous asyn ajax requests per page.

So until I close my comet Ajax request, my 2nd request doesn't get completed, doesn't even go out from the browser. And when I checked with Firefox I just one Ajax comet request running all time..so doesn't that leave me one more ajax request?

Also the solution uses IRequiressessionstate for Asynchronous HTTP Handler which I had removed. But it still creates problems on multiple instances of IE7.

I had one work around which is stated here http://support.microsoft.com/kb/282402
it means we can increase the request limit from registry by default is 2.
By changing "MaxConnectionsPer1_0Server" key
in hive "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" we can increase the number of requests.

Basically I want to broadcast information to multiple clients connected to a server using Comet and the clients can also send messages to the Server.
Broadcasting works but the send request back to server doesn't work.

I'm using IIS 6 and ASP.NET .

Are there any more workarounds or ways to send more requests?

References :

How many concurrent AJAX (XmlHttpRequest) requests are allowed in popular browsers?

AJAX, PHP Sessions and simultaneous requests

jquery .ajax request blocked by long running .ajax request

jQuery: Making simultaneous ajax requests, is it possible?

Community
  • 1
  • 1
Amitd
  • 4,769
  • 8
  • 56
  • 82
  • There are 2 project which you may find useful: Comet Ajax for ASP.NET : http://pokein.codeplex.com Open source IIS Tuning tool : http://iistuner.codeplex.com – Zuuum Jan 21 '11 at 08:07

2 Answers2

5

You are limited to 2 connections, but typically that's all you need - 1 to send, 1 to receive, even in IE.

That said, you can totally do this; we do it all the time in WebSync. The solution lies in subdomains.

The thing to note is that IE (and other browsers, although they typically limit to 6 requests, not 2) limits requests per domain - but that limitation is for the entire domain excluding subdomains. So for example, you can have 2 requests open to "www.stackoverflow.com" and 2 more requests open to "static.stackoverflow.com", all at the same time.

Now, you've got to be somewhat careful with this approach, because if you make a request from the www subdomain to the static subdomain, that's considered a cross-domain request, so you're immediately limited to not using direct XHR calls, but at that point you have nevertheless bypassed the 2 connection limit; JSONP, HTML5, etc, are all your friend for bypassing the cross-domain limitations.

Edit

Managing with > 1 instance of IE comes back to the same problem. The limitation applies across all instances. So, if you have two browsers open, and they're both using comet, you're stuck with 2 long-polling connections open. If you've maximized your options, you're going to be connecting those long-polling requests to something like "comet.mysite.com", and your non-long-polling requests will go to "mysite.com". That's the best you'll get without going into wildcard DNS.

Check out some of our WebSync Demos; they work in 2 instances of IE without a problem. If you check out the source, you'll see that the DNS for the streaming connection is different from the main page; we use JSONP to bypass the cross-domain limitation.

Jerod Venema
  • 44,124
  • 5
  • 66
  • 109
2

The main idea in COMET is to keep one client-to-server request open, until a response is necessary.

If you design your code properly, then you don't need more than 2 requests to be open simultaneously. Here's how it works:

  • client uses a central message send-receive loop to send out a request to the server
  • server receives the request and keeps it open.
  • at some point, the server responds to the client.
  • the client (browser) receives the response, handles it in its central message loop.
  • immediately the client sends out another request.
  • repeat

The key is to centralize and asynchronize all communications in the client. So you will never need to have 2 open requests.

But to answer your question directly, no, there are no additional workarounds.

Raise the connection limit or reduce the number of connections you use.

Cheeso
  • 189,189
  • 101
  • 473
  • 713
  • Yes i agree.that part of client repeating request is working well. Trouble is,i cant open one more connection to server (not Comet ..simple ajax) to send data to it at the same time. – Amitd Mar 11 '10 at 13:44