Skip to content

Instantly share code, notes, and snippets.

@santiago
Created January 12, 2010 16:20
Show Gist options
  • Save santiago/275321 to your computer and use it in GitHub Desktop.
Save santiago/275321 to your computer and use it in GitHub Desktop.
require 'sinatra'
require 'sinatra/async'
require 'app'
class AsyncRoutes < Sinatra::Application
register Sinatra::Async
enable :sessions
configure :development do
set :couchdb_server, 'http://localhost:5984'
set :error_log_url, 'http://localhost:5984/errors'
end
# set sinatra's variables
set :app_file, __FILE__
set :root, File.dirname(__FILE__)
apost '/bosh/chat' do
r= RestClient::Resource.new "http://localhost:5280/http-bind", :timeout=>61
response= r.post(request.body.string)
# deliver response only when it is ready
body response
end
end
run AsyncRoutes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment