Class: WebSocket::Driver::Hybi::StreamReader

Inherits:
Object
  • Object
show all
Defined in:
lib/websocket/driver/hybi/stream_reader.rb

Instance Method Summary collapse

Constructor Details

#initializeStreamReader

Returns a new instance of StreamReader.



6
7
8
# File 'lib/websocket/driver/hybi/stream_reader.rb', line 6

def initialize
  @queue = []
end

Instance Method Details

#put(bytes) ⇒ Object



14
15
16
17
# File 'lib/websocket/driver/hybi/stream_reader.rb', line 14

def put(bytes)
  return unless bytes and bytes.size > 0
  @queue.concat(bytes)
end

#read(length) ⇒ Object



10
11
12
# File 'lib/websocket/driver/hybi/stream_reader.rb', line 10

def read(length)
  read_bytes(length)
end