On Thu, Feb 10, 2011 at 12:03 PM, Shea Barton <shea / sysach.com> wrote:
> Can anyone give many any tips about how to have multiple
> EventMachine.connect instances running at the same time? I thought
> em-synchrony looked promising, but it only works with
> EventMachine::HttpRequest.
>
> I need EventMachine.connect because my application streams http data
> using the receive_data callback, which EventMachine::HttpRequest lacks.
>
> If I try running more than one streaming EventMachine.connect normally
> inside EM.run, I only see the results of the last EventMachine.connect

You are doing something wrong.

EM.connect, just like everything else in EM, is asynchronous. You can
connect to many places at the same time. I've done tests with 20000
connections before.

As for receive_data, all connection handlers have a receive_data,
since that is what EM calls when it receives a chunk of data. If the
handler descends from EventMachine::Connection, it will have a default
receive_data defined for it.

However:

https://github.com/eventmachine/em-http-request/blob/master/lib/em-http/client.rb#L226

You need to provide more details about what you are doing before
anyone is going to be able to tell you what you are doing wrong.


Kirk Haines
Software Developer
Engine Yard