Skip to content

Instantly share code, notes, and snippets.

@dineshprabu-freshdesk
Created December 1, 2016 15:55
Show Gist options
  • Save dineshprabu-freshdesk/e2681b538da95e7b163e6eba3e63d786 to your computer and use it in GitHub Desktop.
Save dineshprabu-freshdesk/e2681b538da95e7b163e6eba3e63d786 to your computer and use it in GitHub Desktop.
[Ruby] Async HTTP request with Faraday and EM
require 'em-http-request'
require 'faraday'
conn = Faraday.new "http://httpbin.org" do |con|
con.adapter :em_http
end
r = conn.get '/ip'
p r.finished? #For checking completion
#Run on completion
r.on_complete{
p r.body
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment