Sha256: c6939b5101204a3a2be935d27619a0d62f4ac84a29aee8e7ec74dcff4b5be95a

Contents?: true

Size: 539 Bytes

Versions: 17

Compression:

Stored size: 539 Bytes

Contents

# based on examples/streaming.rb in git://github.com/lifo/cramp
# commit ca54f8a944ae582a0c858209daf3c74efea7d27c

# Rack::Lint does not like async + EM stuff, so disable it:
#\ -E deployment

require 'cramp/controller'

class StreamController < Cramp::Controller::Action
  periodic_timer :send_data, :every => 1
  periodic_timer :check_limit, :every => 2

  def start
    @limit = 0
  end

  def send_data
    render ["Hello World", "\n"]
  end

  def check_limit
    @limit += 1
    finish if @limit > 1
  end

end

run StreamController

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
rainbows-3.1.0 t/cramp/streaming.ru
rainbows-3.0.0 t/cramp/streaming.ru
rainbows-2.1.0 t/cramp/streaming.ru
rainbows-2.0.1 t/cramp/streaming.ru
rainbows-2.0.0 t/cramp/streaming.ru
rainbows-1.0.0 t/cramp/streaming.ru
rainbows-1.0.0pre1 t/cramp/streaming.ru
rainbows-0.97.0 t/cramp/streaming.ru
rainbows-0.96.0 t/cramp/streaming.ru
rainbows-0.95.1 t/cramp/streaming.ru
rainbows-0.95.0 t/cramp/streaming.ru
rainbows-0.94.0 t/cramp/streaming.ru
rainbows-0.93.0 t/cramp/streaming.ru
rainbows-0.92.0 t/cramp/streaming.ru
rainbows-0.91.1 t/cramp/streaming.ru
rainbows-0.91.0 t/cramp/streaming.ru
rainbows-0.90.2 t/cramp/streaming.ru