Sha256: f3d4cde6b1567823ca9c5a05af4df5357197097bc2749167b040855383c24003

Contents?: true

Size: 574 Bytes

Versions: 2

Compression:

Stored size: 574 Bytes

Contents

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

class Streamer
  include Reel::App

  get '/' do
    body = Reel::Stream.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, {
      'Transfer-Encoding' => 'identity',
      'Content-Type' => 'text/html'
    }, body]
  end
end

Streamer.new("0.0.0.0", 9292)
sleep

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reel-0.4.0.pre2 examples/stream.rb
reel-0.4.0.pre examples/stream.rb