Comet and Simultaneous Ajax request

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 …

via Asp.Net Developed Tutorials » Search Results » ajax:

Comet and Simultaneous Ajax request

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 doesnt get completed ,doesnt even go out from the browser. And when i checked with Firefox i just one Ajax comet request running all time..so doesnt that leave me one more ajax request?
Also the solution uses IRequiressessionstate for Asynchronous HTTP Handler which i had removed.but still it 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_USERSoftwareMicrosoftWindowsCurrentVersionInternet 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 doesnt work.
Im using IIS 6 and ASP.NET .
Are there any more workarounds or ways to send more requests?
References :
http://stackoverflow.com/questions/561046/how-many-concurrent-ajax-xmlhttprequest-requests-are-allowed-in-popular-browser
http://stackoverflow.com/questions/349381/ajax-php-sessions-and-simultaneous-requests
http://stackoverflow.com/questions/2412807/jquery-ajax-request-blocked-by-long-running-ajax-request
http://stackoverflow.com/questions/898190/jquery-making-simultaneous-ajax-requests-is-it-possible
……………………………………..

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.
……………………………………..

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.

For more info: Comet and Simultaneous Ajax request

Asp.Net Developed Tutorials » Search Results » ajax

Comet and Simultaneous Ajax request

Share this post:

Related Posts

Leave a Comment