# How to make asynchronus http request?

**URL:** <https://www.ruby-forum.com/t/how-to-make-asynchronus-http-request/129955>\
**Category:** Rails\
**Created:** [February 23, 2008, 12:59am UTC](https://www.ruby-forum.com/t/how-to-make-asynchronus-http-request/129955 "2008-02-23T00:59:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmehta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ea666f/32.png) [@rmehta](https://www.ruby-forum.com/u/rmehta)\
**Post date:** [February 23, 2008, 12:59am UTC](https://www.ruby-forum.com/t/how-to-make-asynchronus-http-request/129955/1 "2008-02-23T00:59:48Z")

</div>

Hi,

In my application I have to send an http post request to another server  
for some processing. My application crashes if it has to make 100+  
requests in a loop based on some business logic. Basically, user is just  
waiting for the whole processing to be finished before he could do  
something else. I realize that best option is to put the whole  
processing in a background job. Now my problem is that I can’t figure  
out a way to do asynchronus http post for sending a request to remote  
server. Till now I have been using Net:Http post but this is call which  
is causing the problem. Also can you please suggest as to how can  
schedule the background job to be fired at particular date/time to make  
all the asynchronus call in the background.

Any help is greatly appreciated.

Thanks.

---

<div class="post-metadata">

**Author:** ![rmehta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ea666f/32.png) [@rmehta](https://www.ruby-forum.com/u/rmehta)\
**Post date:** [February 23, 2008, 8:45pm UTC](https://www.ruby-forum.com/t/how-to-make-asynchronus-http-request/129955/2 "2008-02-23T20:45:17Z")

</div>

Rm Rm wrote:

> Any help is greatly appreciated.
> 
> Thanks.

check out remote\_function(), link\_to\_remote(), submit\_to\_remote() for  
server side async processing.

hth

ilan

---

<div class="post-metadata">

**Author:** ![rmehta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ea666f/32.png) [@rmehta](https://www.ruby-forum.com/u/rmehta)\
**Post date:** [February 24, 2008, 4:49pm UTC](https://www.ruby-forum.com/t/how-to-make-asynchronus-http-request/129955/3 "2008-02-24T16:49:38Z")

</div>

I have used these for making ajax call from client side rhtml codes. Can  
I use these calls from server-side also to make async calls to another  
domain ?

Ilan B. wrote:

> Rm Rm wrote:
> 
> > Any help is greatly appreciated.
> > 
> > Thanks.
> 
> check out remote\_function(), link\_to\_remote(), submit\_to\_remote() for  
> server side async processing.
> 
> hth
> 
> ilan

---

<div class="post-metadata">

**Author:** ![rmehta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ea666f/32.png) [@rmehta](https://www.ruby-forum.com/u/rmehta)\
**Post date:** [February 24, 2008, 9:25pm UTC](https://www.ruby-forum.com/t/how-to-make-asynchronus-http-request/129955/4 "2008-02-24T21:25:32Z")

</div>

Rm Rm wrote:

> I have used these for making ajax call from client side rhtml codes. Can  
> I use these calls from server-side also to make async calls to another  
> domain ?
> 
> Ilan B. wrote:
> 
> > Rm Rm wrote:
> > 
> > > Any help is greatly appreciated.
> > > 
> > > Thanks.
> > 
> > check out remote\_function(), link\_to\_remote(), submit\_to\_remote() for  
> > server side async processing.
> > 
> > hth
> > 
> > ilan

No, these methods get translated into javascript callbacks, if you need  
to it from the server side, then take a look at the gem machanize,on the  
server, you are totally free to spin off a new thread to make a request  
anywhere you want…

---

<div class="post-metadata">

**Author:** ![rmehta](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ea666f/32.png) [@rmehta](https://www.ruby-forum.com/u/rmehta)\
**Post date:** [February 25, 2008, 9:44pm UTC](https://www.ruby-forum.com/t/how-to-make-asynchronus-http-request/129955/5 "2008-02-25T21:44:27Z")

</div>

BackgroundRb is another good option. You can start the request in  
another thread and monitor it’s progress from the controller.

On Feb 24, 3:25 pm, Ilan B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
