t: only enable Revactor tests under 1.9.2 for now
[rainbows.git] / t / cramp / streaming.ru
blob217c49769084d43908955cf4f7b47ca8345c41ec
1 # based on examples/streaming.rb in git://github.com/lifo/cramp
2 # commit ca54f8a944ae582a0c858209daf3c74efea7d27c
4 # Rack::Lint does not like async + EM stuff, so disable it:
5 #\ -E deployment
7 require 'cramp'
9 class StreamController < Cramp::Action
10   periodic_timer :send_data, :every => 1
11   periodic_timer :check_limit, :every => 2
13   def start
14     @limit = 0
15   end
17   def send_data
18     render ["Hello World", "\n"]
19   end
21   def check_limit
22     @limit += 1
23     finish if @limit > 1
24   end
26 end
28 run StreamController