Skip to content

Instantly share code, notes, and snippets.

@jondot
Created August 11, 2012 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jondot/3327136 to your computer and use it in GitHub Desktop.
Save jondot/3327136 to your computer and use it in GitHub Desktop.
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
@romanbsd
Copy link

give em-synchrony a try ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment