File: //usr/local/rvm/gems/ruby-3.0.2/doc/actionpack-6.1.4.1/ri/ActionController/Live/SSE/cdesc-SSE.ri
U:RDoc::NormalClass[iI"SSE:ETI" ActionController::Live::SSE;TI"Object;To:RDoc::Markup::Document:@parts[o;;[o:RDoc::Markup::Paragraph;[I"IThis class provides the ability to write an SSE (Server Sent Event) ;TI"Mto an IO stream. The class is initialized with a stream and can be used ;TI"Oto either write a JSON string or an object which can be converted to JSON.;To:RDoc::Markup::BlankLine o; ;[I"NWriting an object will convert it into standard SSE format with whatever ;TI"Noptions you have configured. You may choose to set the following options:;T@o:RDoc::Markup::Verbatim;[I"K1) Event. If specified, an event with this name will be dispatched on
;TI"the browser.
;TI"J2) Retry. The reconnection time in milliseconds used when attempting
;TI"to send the event.
;TI"M3) Id. If the connection dies while sending an SSE to the browser, then
;TI"Pthe server will receive a +Last-Event-ID+ header with value equal to +id+.
;T:@format0o; ;[I"NAfter setting an option in the constructor of the SSE object, all future ;TI"JSSEs sent across the stream will use those options unless overridden.;T@o; ;[I"Example Usage:;T@o;;[I"1class MyController < ActionController::Base
;TI"& include ActionController::Live
;TI"
;TI" def index
;TI"@ response.headers['Content-Type'] = 'text/event-stream'
;TI"I sse = SSE.new(response.stream, retry: 300, event: "event-name")
;TI"$ sse.write({ name: 'John'})
;TI", sse.write({ name: 'John'}, id: 10)
;TI"B sse.write({ name: 'John'}, id: 10, event: "other-event")
;TI"N sse.write({ name: 'John'}, id: 10, event: "other-event", retry: 500)
;TI" ensure
;TI" sse.close
;TI" end
;TI" end
;T;0o; ;[I"ONote: SSEs are not currently supported by IE. However, they are supported ;TI"+by Chrome, Firefox, Opera, and Safari.;T:
@fileI"(lib/action_controller/metal/live.rb;T:0@omit_headings_from_table_of_contents_below0;
0;0[ [U:RDoc::Constant[i I"PERMITTED_OPTIONS;TI"3ActionController::Live::SSE::PERMITTED_OPTIONS;T:public0o;;[ ;
@;;0@;@cRDoc::NormalClass0[ [[I"
class;T[[;[[I"new;TI"(lib/action_controller/metal/live.rb;T[:protected[ [:private[ [I"
instance;T[[;[[I"
close;T@N[I"
write;T@N[;[ [;[[I"perform_write;T@N[ [U:RDoc::Context::Section[i 0o;;[ ;
0;0[@;I"ActionController::Live;TcRDoc::NormalModule