class Riffer::Wire::SSE
rbs_inline: enabled
Public Class Methods
Source
# File lib/riffer/wire/sse.rb, line 11 def initialize @buffer = +"" @data = [] @event = nil end
Public Instance Methods
Source
# File lib/riffer/wire/sse.rb, line 19 def feed(chunk, &) @buffer << chunk # Lines end in LF or CRLF. The SSE spec also allows a bare CR, which no # supported provider sends. while (line_end = @buffer.index("\n")) line = @buffer.slice!(0, line_end + 1).to_s.chomp process_line(line, &) end end