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
Problems with the Rails Console, Rvm and Readline
What's the Difference Between Gem_Home and Gem_Path
Using a String as a Variable at Run Time
Double-Splat Operator Destructively Modifies Hash - Is This a Ruby Bug
Uninstall Old Versions of Ruby Gems
How to Pass Parameter on 'Vagrant Up' and Have It in the Scope of Vagrantfile
Ruby on Rails: Alias_Method_Chain, What Exactly Does It Do
Determine Ruby Version from Within Rails
Contact Form Mailer in Rails 4
How Does Shovel (<<) Operator Work in Ruby Hashes
Given an Array of Arguments, How to Send Those Arguments to a Particular Function in Ruby
Rails - Sort by Join Table Data
What Is an Illegal Octal Digit
Why Do People Say That Ruby Is Slow