Asynchronous Http Request in Ruby

asynchronous http request in ruby

Lightweight Async handling is the job of Threads (as you said) or Fibers.

Otherwise, you should consider EventMachine which is a very powerful tool.

EDIT: The above URL for Event Machine is dead. Here is their GitHub account, https://github.com/eventmachine/eventmachine . It serves as a good starting point.

asynchronously call multiple GET requests from Ruby

The async-http gem did exactly what I want.

https://github.com/socketry/async-http

Can I make asynchronous requests with Ruby's Typhoeus?

You could try using a thread:

response = nil

request_thread = Thread.new {
# Set up the request object here
response = request.response
}

From there you can check response == nil to see if the request has been made yet, and you can call request_thread.join to block until the thread is done executing.



Related Topics



Leave a reply



Submit