Created
August 11, 2012 20:39
-
-
Save jondot/3327136 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'eventmachine' | |
require 'em-http-request' | |
require 'thin' | |
get '/' do | |
r = EventMachine::HttpRequest.new('http://google.com').get | |
r.callback do | |
# | |
# custom processing | |
# | |
content_type :html | |
response.status = 200 | |
response.body= Array("hello") | |
result = response.finish# m.responses.inspect.to_s | |
request.env['async.callback'][ result ] | |
end | |
throw :async | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
give em-synchrony a try ;)