Permalink
Browse files

First a really simple test.

  • Loading branch information...
0 parents commit c2c155b54bca259ceeb53944d8aea0456d273f9d @tekacs tekacs committed Jun 1, 2011
Showing with 55 additions and 0 deletions.
  1. +2 −0 Gemfile
  2. +33 −0 Gemfile.lock
  3. +1 −0 Procfile
  4. +19 −0 app.rb
@@ -0,0 +1,2 @@
+source :rubygems
+gem 'goliath'
@@ -0,0 +1,33 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ async-rack (0.5.1)
+ rack (~> 1.1)
+ em-synchrony (0.3.0.beta.1)
+ eventmachine (>= 1.0.0.beta.1)
+ eventmachine (1.0.0.beta.3)
+ goliath (0.9.1)
+ async-rack
+ em-synchrony (>= 0.3.0.beta.1)
+ eventmachine (>= 1.0.0.beta.1)
+ http_parser.rb
+ log4r
+ multi_json
+ rack (>= 1.2.2)
+ rack-contrib
+ rack-respond_to
+ http_parser.rb (0.5.1)
+ log4r (1.1.9)
+ multi_json (1.0.3)
+ rack (1.3.0)
+ rack-accept-media-types (0.9)
+ rack-contrib (1.1.0)
+ rack (>= 0.9.1)
+ rack-respond_to (0.9.8)
+ rack-accept-media-types (>= 0.6)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ goliath
@@ -0,0 +1 @@
+web: bundle exec ruby app.rb -sv -e production -p $PORT
19 app.rb
@@ -0,0 +1,19 @@
+require 'rubygems'
+require 'bundler'
+Bundler.require
+
+class Stream < Goliath::API
+ def on_close(env)
+ env.logger.info "Connection closed."
+ end
+
+ def response(env)
+ i = 0
+
+ keepalive = EM.add_periodic_timer(1) do
+ env.stream_send(".\n")
+ end
+
+ streaming_response(202, {})
+ end
+end

0 comments on commit c2c155b

Please sign in to comment.