Skip to content

Instantly share code, notes, and snippets.

@kenn
Created March 24, 2010 04:45
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 kenn/341995 to your computer and use it in GitHub Desktop.
Save kenn/341995 to your computer and use it in GitHub Desktop.
class Comet < Sinatra::Base
register Sinatra::Async
@@pool = []
aget '/observe' do
@@pool.push self
end
aget '/notify' do
@@pool.each {|observer| observer.body { "hi!" } }
@@pool = []
body "sent!"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment