Class: EventMachine::IOStreamer

Inherits:
Object
  • Object
show all
Includes:
Deferrable
Defined in:
lib/em/io_streamer.rb

Constant Summary collapse

CHUNK_SIZE =
16384

Constants included from Deferrable

Deferrable::Pool

Instance Method Summary collapse

Methods included from Deferrable

#callback, #cancel_callback, #cancel_errback, #cancel_timeout, #errback, #fail, future, #set_deferred_status, #succeed, #timeout

Constructor Details

#initialize(connection, io, opts = {}) ⇒ IOStreamer

Returns a new instance of IOStreamer.

Parameters:

Options Hash (opts):

  • :http_chunks (Boolean) — default: false

    Use HTTP 1.1 style chunked-encoding semantics.



33
34
35
36
37
38
39
40
41
# File 'lib/em/io_streamer.rb', line 33

def initialize(connection, io, opts = {})
  @connection = connection
  @io = io
  @http_chunks = opts[:http_chunks]

  @buff = String.new
  @io.binmode if @io.respond_to?(:binmode)
  stream_one_chunk
end