Here is my code:
EventMachine.run {
conn = EM::Protocols::HttpClient2.connect request.host, 80
req = conn.get(request.query)
req.callback { |response|
p(response.status)
p(response.headers)
p(response.content)
}
}
Callbacks i.e. I get status string outputs, etc.
But what I want is to start callbacks and then retry. I plan to implement more logic, for example, setting up a URL every time, but for now I just want to:
- Get URL
- Fry callbacks
- Repeat ...
My understanding of this pattern was that everything in this loop fires and then returns, and then lasts forever until I do EM.stop.
It is currently retrieving the URL data and just seems to hang.
Do I need to make some sort of refund in order to continue here? Why is it hanging and not looping over and over?
, ... end .. ? , , , , EM.run, , .