File: //usr/local/rvm/gems/ruby-3.0.2/doc/actionpack-6.1.4.1/ri/ActionController/Live/cdesc-Live.ri
U:RDoc::NormalModule[iI" Live:ETI"ActionController::Live;T0o:RDoc::Markup::Document:@parts[o;;[
o:RDoc::Markup::Paragraph;[I"NMix this module into your controller, and all actions in that controller ;TI"?will be able to stream data to the client as it's written.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim;[I"1class MyController < ActionController::Base
;TI"& include ActionController::Live
;TI"
;TI" def stream
;TI"@ response.headers['Content-Type'] = 'text/event-stream'
;TI" 100.times {
;TI"1 response.stream.write "hello world\n"
;TI" sleep 1
;TI" }
;TI" ensure
;TI" response.stream.close
;TI" end
;TI" end
;T:@format0o; ;[
I"TThere are a few caveats with this module. You *cannot* write headers after the ;TI"Kresponse has been committed (Response#committed? will return truthy). ;TI"OCalling +write+ or +close+ on the response stream will cause the response ;TI"Pobject to be committed. Make sure all headers are set before calling write ;TI"or close on your stream.;T@o; ;[I"NYou *must* call close on your stream when you're finished, otherwise the ;TI"%socket may be left open forever.;T@o; ;[I"RThe final caveat is that your actions are executed in a separate thread than ;TI"Qthe main thread. Make sure your actions are thread safe, and this shouldn't ;TI":be a problem (don't share state across threads, etc).;T:
@fileI"(lib/action_controller/metal/live.rb;T:0@omit_headings_from_table_of_contents_below0o;;[ ;
I"'lib/action_controller/test_case.rb;T;0;
0;0[ [ [ [[I"
class;T[[:public[ [:protected[ [:private[ [I"
instance;T[[;[[I"process;TI"(lib/action_controller/metal/live.rb;T[I"response_body=;T@I[;[ [;[[I"log_error;T@I[[I"ActiveSupport::Concern;To;;[ ;
@1;0@I[U:RDoc::Context::Section[i 0o;;[ ;
0;0[@1@4I"ActionController;TcRDoc::NormalModule