Module: Rack::App::InstanceMethods::Streaming
- Included in:
- Rack::App::InstanceMethods
- Defined in:
- lib/rack/app/instance_methods/streaming.rb
Instance Method Summary collapse
-
#stream(keep_open = false, &back) ⇒ Object
Copyright © 2007, 2008, 2009 Blake Mizerany Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016 Konstantin Haase.
Instance Method Details
#stream(keep_open = false, &back) ⇒ Object
Copyright © 2007, 2008, 2009 Blake Mizerany Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016 Konstantin Haase
Allows to start sending data to the client even though later parts of the response body have not yet been generated.
The close parameter specifies whether Stream#close should be called after the block has been executed. This is only relevant for evented servers like Thin or Rainbows.
12 13 14 15 |
# File 'lib/rack/app/instance_methods/streaming.rb', line 12 def stream(keep_open = false, &back) response.body = Rack::App::Streamer.new(request.env, :keep_open => keep_open, &back) finish! end |