Sha256: 41031b8a50aeefe69b987353f6225973988c7b5a76b68339fda5982d83f8feac

Contents?: true

Size: 578 Bytes

Versions: 10

Compression:

Stored size: 578 Bytes

Contents

require 'rubygems'
require 'bundler/setup'
require 'reel'

app = Rack::Builder.new do
  map '/' do
    run lambda { |env|
      body = Reel::ChunkStream.new do |body|
        # sending a payload to make sure browsers will render chunks as received
        body << "<html>#{' '*1024}\n"
        ('A'..'Z').each do |l|
          body << "<div>#{l}</div>\n"
          sleep 0.5
        end
        body << "</html>\n"
        body.finish
      end
      [200, {
        'Content-Type' => 'text/html'
        }, body]
    }
  end
end.to_app

Rack::Handler::Reel.run app, Port: 9292

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
reel-0.4.0 examples/chunked.rb
reel-0.4.0.pre7 examples/chunked.rb
reel-0.4.0.pre6 examples/chunked.rb
reel-0.4.0.pre5 examples/chunked.rb
reel-0.4.0.pre4 examples/chunked.rb
reel-0.4.0.pre3 examples/chunked.rb
reel-0.4.0.pre2 examples/chunked.rb
reel-0.4.0.pre examples/chunked.rb
reel-0.3.0 examples/chunked.rb
reel-0.3.0.pre examples/chunked.rb