Eventmachine http

Hi,

I am working on a ruby script that download some web page (from a list
of url stored in an array) but it takes some time to do it and when the
script use openuri, the script still waiting until it gets response from
remote server
I found about EventMachine and em-http on internet but I don't find a
good tutorial for that
what I want is launching simultaneously N web requests and treat the
result in parallel:

launch by 5 url
{
download page
parse page
}

regards

···

--
Posted via http://www.ruby-forum.com/.

Here's an example script to do exactly that:

pete

···

On Wed, Jan 4, 2012 at 6:25 AM, rubix Rubix <aggouni2002@yahoo.fr> wrote:

Hi,

I am working on a ruby script that download some web page (from a list
of url stored in an array) but it takes some time to do it and when the
script use openuri, the script still waiting until it gets response from
remote server
I found about EventMachine and em-http on internet but I don't find a
good tutorial for that
what I want is launching simultaneously N web requests and treat the
result in parallel:

launch by 5 url
{
download page
parse page
}

regards

--
Posted via http://www.ruby-forum.com/\.

thx,

Is there a way to use EventMachine to access database too (executing sql
requests waiting for http response)?
regards,

···

--
Posted via http://www.ruby-forum.com/.