Class: WebSocket::Driver::Hybi::Message
- Inherits:
-
Object
- Object
- WebSocket::Driver::Hybi::Message
- Defined in:
- lib/websocket/driver/hybi/message.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#opcode ⇒ Object
Returns the value of attribute opcode.
-
#rsv1 ⇒ Object
Returns the value of attribute rsv1.
-
#rsv2 ⇒ Object
Returns the value of attribute rsv2.
-
#rsv3 ⇒ Object
Returns the value of attribute rsv3.
Instance Method Summary collapse
- #<<(frame) ⇒ Object
-
#initialize ⇒ Message
constructor
A new instance of Message.
Constructor Details
#initialize ⇒ Message
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
#data ⇒ Object
Returns the value of attribute data.
6 7 8 |
# File 'lib/websocket/driver/hybi/message.rb', line 6 def data @data end |
#opcode ⇒ Object
Returns the value of attribute opcode.
6 7 8 |
# File 'lib/websocket/driver/hybi/message.rb', line 6 def opcode @opcode end |
#rsv1 ⇒ Object
Returns the value of attribute rsv1.
6 7 8 |
# File 'lib/websocket/driver/hybi/message.rb', line 6 def rsv1 @rsv1 end |
#rsv2 ⇒ Object
Returns the value of attribute rsv2.
6 7 8 |
# File 'lib/websocket/driver/hybi/message.rb', line 6 def rsv2 @rsv2 end |
#rsv3 ⇒ Object
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 |