Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rkh/rack-async-stream
Ever tried streaming with Thin? Didn't work? Use this middleware.
https://github.com/rkh/rack-async-stream
Last synced: about 1 month ago
JSON representation
Ever tried streaming with Thin? Didn't work? Use this middleware.
- Host: GitHub
- URL: https://github.com/rkh/rack-async-stream
- Owner: rkh
- Created: 2011-07-07T12:06:51.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2011-07-07T12:07:07.000Z (over 13 years ago)
- Last Synced: 2024-02-13T06:14:58.353Z (9 months ago)
- Language: Ruby
- Size: 85.9 KB
- Stars: 10
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
``` ruby
# config.ru
class SlowStream
def each
100.times do |i|
yield "We're at #{i}\n"
sleep 0.5
end
end
enduse Rack::AsyncStream
run proc { [200, {'Content-Type' => 'text/plain'}, SlowStream.new] }
```