Sha256: edde1d13714e1787e20f53534d8c429500d85f7058ea46c13eda110fdd5fb65e

Contents?: true

Size: 516 Bytes

Versions: 25

Compression:

Stored size: 516 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'

class StreamController < Cramp::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

25 entries across 25 versions & 1 rubygems

Version Path
rainbows-5.2.1 t/cramp/streaming.ru
rainbows-5.2.0 t/cramp/streaming.ru
rainbows-5.1.1 t/cramp/streaming.ru
rainbows-5.1.0 t/cramp/streaming.ru
rainbows-5.0.0.5.ge717 t/cramp/streaming.ru
rainbows-5.0.0 t/cramp/streaming.ru
rainbows-4.7.0 t/cramp/streaming.ru
rainbows-4.6.2 t/cramp/streaming.ru
rainbows-4.6.1 t/cramp/streaming.ru
rainbows-4.6.0.4.g4108 t/cramp/streaming.ru
rainbows-4.6.0 t/cramp/streaming.ru
rainbows-4.5.0 t/cramp/streaming.ru
rainbows-4.4.3 t/cramp/streaming.ru
rainbows-4.4.2 t/cramp/streaming.ru
rainbows-4.4.1.1.gd5c8c t/cramp/streaming.ru
rainbows-4.4.1 t/cramp/streaming.ru
rainbows-4.4.0 t/cramp/streaming.ru
rainbows-4.3.1 t/cramp/streaming.ru
rainbows-4.3.0 t/cramp/streaming.ru
rainbows-4.2.0 t/cramp/streaming.ru