Class: WebSocket::Driver::Hybi::Message

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMessage

Returns a new instance of Message.



12
13
14
15
16
17
18
# File 'lib/websocket/driver/hybi/message.rb', line 12

def initialize
  @rsv1   = false
  @rsv2   = false
  @rsv3   = false
  @opcode = nil
  @data   = String.new('').force_encoding(Encoding::BINARY)
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



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

def data
  @data
end

#opcodeObject

Returns the value of attribute opcode.



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

def opcode
  @opcode
end

#rsv1Object

Returns the value of attribute rsv1.



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

def rsv1
  @rsv1
end

#rsv2Object

Returns the value of attribute rsv2.



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

def rsv2
  @rsv2
end

#rsv3Object

Returns the value of attribute rsv3.



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

def rsv3
  @rsv3
end

Instance Method Details

#<<(frame) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/websocket/driver/hybi/message.rb', line 20

def <<(frame)
  @rsv1   ||= frame.rsv1
  @rsv2   ||= frame.rsv2
  @rsv3   ||= frame.rsv3
  @opcode ||= frame.opcode
  @data   <<  frame.payload
end