Questions tagged [em-http-request]

Async EventMachine HTTP client, with support for asynchronous HTTP connection with support for proxys and Basic Auth & OAuth.

Async (EventMachine) HTTP client, with support for:

  • Asynchronous HTTP API for single & parallel request execution
  • Keep-Alive and HTTP pipelining support
  • Auto-follow 3xx redirects with max depth
  • Automatic gzip & deflate decoding
  • Streaming response processing
  • Streaming file uploads
  • HTTP proxy and SOCKS5 support
  • Basic Auth & OAuth
  • Connection-level & Global middleware support
  • HTTP parser via http_parser.rb
  • Works wherever EventMachine runs: Rubinius, JRuby, MRI

See also the official homepage.

11 questions
1
vote
0 answers

Is there a solution for the issue with multiple http calls returning "connection closed by server"?

I am attempting to hit the Amazon api with api calls for a bunch of services across all the regions. Approx 200+ API calls. Using em-http-request to make the calls some complete while some fail with the error "connection closed by server" I have…
david
  • 88
  • 6
1
vote
1 answer

event machine with em http gem cannot load middleware oauth

I am trying to get the stock price streaming to work using TradeKing API https://developers.tradeking.com/documentation/ruby-streaming or the copied and pasted codes below require 'em-http' require 'em-http/middleware/oauth' credentials = { …
Guy
  • 79
  • 2
  • 12
1
vote
0 answers

How to complete HTTP requests without stopping EventMachine?

I want to use Ruby EventMachine and em-http-request to run parallel HTTP synchronous requests triggered from different threads. The idea is to run a single reactor in its own thread and push HTTP requests to complete on its event queue thanks to…
1
vote
1 answer

Using EventMachine to make multiple request using same connection?

I have an EventMachine running that is listening for UDP packets. Every time a UDP packet is received, I would like to forward the data to some database using a REST call. I have created an EM::Connection subclass in which the receive_data method…
Wahaj Ali
  • 4,093
  • 3
  • 23
  • 35
1
vote
0 answers

How to make certain (limited) number of api requests using rubys em-http-request?

I have an API with limited number of calls per sec (100 requests per 100 sec). How can I utilize em-http-request (ideally with Redis) to make such calls at the fastest rate possible (to not exceed api rate limit?).
1
vote
2 answers

How to test for asynchronous HTTP requests in ruby using EventMachine

I'm getting messages of a RabbitMQ queue and each message is a URL that I want to make a request to. Now I'm using the AMQP gem to subscribe to the queue and that uses EventMachine, so I'm using the the em-http-request library to make the http…
1
vote
0 answers

em-http-request unexpected result when using tor as proxy

I've created a gist which shows exactly what happens. https://gist.github.com/4418148 I've tested a version which used ruby's 'net/http' library and 'socksify/http' and it worked perfect but if the EventMachine version returns an unexpected…
Jahan Zinedine
  • 14,616
  • 5
  • 46
  • 70
0
votes
1 answer

Get only response headers in em_http_request

How can I get only response headers in an em_http_request? I tried to use this code: EventMachine.run do http = EventMachine::HttpRequest.new('my_url').get http.headers do |headers| Fiber.current.resume headers end end but I don't want…
Falcon
  • 1,461
  • 3
  • 15
  • 29
0
votes
1 answer

Simple POST request failing with em-http-request

The following query works with…
itdoesntwork
  • 4,666
  • 3
  • 25
  • 38
0
votes
1 answer

EM-HTTP-REQUEST and SINATRA - combining/merging multiple api request into one result?

My first time dealing with sinatra and parallel em-http-request. And i dont know how to combine/merge into one results and when to EventMachine.stop? . Consider this: get '/data/:query' do content_type :json EventMachine.run do http1 =…
Jakub Kuchar
  • 1,665
  • 2
  • 23
  • 39
0
votes
1 answer

em-synchrony using http.get and iterators causing can't yield in root Fiber error

A very simple case where I get the root Fiber error. require 'em-synchrony' require 'em-synchrony/em-http' urls = %w{http://www.google.com http://www.google.com http://www.google.com http://www.google.com http://www.google.com…
keaplogik
  • 2,369
  • 2
  • 25
  • 26