Skip to content

Ever tried streaming with Thin? Didn't work? Use this middleware.

Notifications You must be signed in to change notification settings

rkh/rack-async-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Rack::AsyncStream

Ever tried to use streaming with Thin? Didn't work? Fear not! Just use this middleware!

Works with Ruby 1.8.7, 1.9, JRuby, Rubinius, any Rails version since 2.3, any version of Sinatra, your stand-alone Rack app and probably a lot more libraries, frameworks and Ruby implementations.

Usage

# config.ru
class SlowStream
  def each
    100.times do |i|
      yield "We're at #{i}\n"
      sleep 0.5
    end
  end
end

use Rack::AsyncStream
run proc { [200, {'Content-Type' => 'text/plain'}, SlowStream.new] }

About

Ever tried streaming with Thin? Didn't work? Use this middleware.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages