# Non-blocking ajax requests

**URL:** <https://www.ruby-forum.com/t/non-blocking-ajax-requests/113083>\
**Category:** Rails\
**Created:** [August 27, 2007, 12:29pm UTC](https://www.ruby-forum.com/t/non-blocking-ajax-requests/113083 "2007-08-27T12:29:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![martijn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/dbc845/32.png) [@martijn](https://www.ruby-forum.com/u/martijn)\
**Post date:** [August 27, 2007, 12:29pm UTC](https://www.ruby-forum.com/t/non-blocking-ajax-requests/113083/1 "2007-08-27T12:29:48Z")

</div>

Hello group!

I have a problem using multiple ajax updaters on one page. The first  
one is  
a slow one; it a form\_remote\_tag and it calls a method that takes  
about 5  
seconds to process. The second one is faster, it’s a periodical  
updater that  
polls and updates a div every second. The problem is that as soon as i  
click  
on the ‘slow’ submitbutton, my fast periodical updater stops updating  
during  
the request (~5 sec).

My question is, is there a way to make a request non-blocking, so that  
other  
ajaxrequests can still be processed?

thanks!

Martijn

---

<div class="post-metadata">

**Author:** ![martijn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/dbc845/32.png) [@martijn](https://www.ruby-forum.com/u/martijn)\
**Post date:** [August 27, 2007, 6:28pm UTC](https://www.ruby-forum.com/t/non-blocking-ajax-requests/113083/2 "2007-08-27T18:28:30Z")

</div>

Martijn wrote:

> Hello group!
> 
> I have a problem using multiple ajax updaters on one page. The first  
> one is  
> a slow one; it a form\_remote\_tag and it calls a method that takes  
> about 5  
> seconds to process. The second one is faster, it’s a periodical  
> updater that  
> polls and updates a div every second. The problem is that as soon as i  
> click  
> on the ‘slow’ submitbutton, my fast periodical updater stops updating  
> during  
> the request (~5 sec).
> 
> My question is, is there a way to make a request non-blocking, so that  
> other  
> ajaxrequests can still be processed?
> 
> thanks!
> 
> Martijn

Ajax requests are “Asynchronous” as the acronym implies, but there is a  
catch. The browser will only allow a certain number of connections to a  
given client at one time. The connection to the server remains open  
throughout the entire Ajax call because the the HTTP protocol only  
allows the server to respond, not to establish a connection. (You knew  
this because you knew you had to poll for new data) I would start by  
checking to see how many simultaneous connections your browser allows.

A second, and perhaps better thought is to make sure your server can  
handle multiple requests simultaneously. Webrick for example will only  
deal with one request at a time. During the 5 seconds it is processing  
tou ‘slow submission’ it cannot update the fast one.

John M.

---

<div class="post-metadata">

**Author:** ![martijn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/dbc845/32.png) [@martijn](https://www.ruby-forum.com/u/martijn)\
**Post date:** [August 29, 2007, 10:50pm UTC](https://www.ruby-forum.com/t/non-blocking-ajax-requests/113083/3 "2007-08-29T22:50:20Z")

</div>

hey, tnx!

especially the notice that webrick only supports one request clears up  
a lot

Martijn

On Aug 27, 6:28 pm, John M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
