From: Daniel DeLorme Date: 2010-05-18T15:56:28+09:00 Subject: Re: Asynchronous HTTP request Daniel N wrote: > On 13 May 2010 17:37, Daniel DeLorme wrote: > >> Does anyone know how to do the following, but without threads, purely with >> asynchronous IO? >> >> website = Thread.new{ Net::HTTP.get(URI.parse(url)) } >> template = compute_lots_of_stuff() >> puts template.sub("", website.value) > > Event machine is perfect for this kind of stuff. Weather it fits with the > rest of your web framework is more likely the thing that makes it an > unlikely selection (if you're using anything rack based for example) If you could show me how to use EventMachine in this case I'd be grateful. I couldn't figure out how to run compute_lots_of_stuff() while the http requests are executing.