Class: Reel::ChunkStream

Inherits:
Stream
  • Object
show all
Defined in:
lib/reel/stream.rb

Instance Method Summary collapse

Methods inherited from Stream

#call, #closed?, #each, #initialize

Constructor Details

This class inherits a constructor from Reel::Stream

Instance Method Details

#closeObject



79
80
81
82
# File 'lib/reel/stream.rb', line 79

def close
  finish
  super
end

#finishObject

finish does not actually close the socket, it only inform the browser there are no more messages



75
76
77
# File 'lib/reel/stream.rb', line 75

def finish
  write "0#{Response::Writer::CRLF * 2}"
end

#write(chunk) ⇒ Object Also known as: <<



65
66
67
68
69
70
# File 'lib/reel/stream.rb', line 65

def write(chunk)
  chunk_header = chunk.bytesize.to_s(16)
  super chunk_header + Response::Writer::CRLF
  super chunk + Response::Writer::CRLF
  self
end