Class: EventMachine::IOStreamer

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

Constant Summary collapse

CHUNK_SIZE =
16384

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of IOStreamer.

Parameters:

  • connection (EventMachine::Connection)
  • io (IO)

    Data source

  • Data (Integer)

    size

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :http_chunks (Boolean) — default: false

    Use HTTP 1.1 style chunked-encoding semantics.



14
15
16
17
18
19
20
21
22
# File 'lib/em/io_streamer.rb', line 14

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