Class: Protocol::WebSocket::TextFrame

Inherits:
Frame
  • Object
show all
Defined in:
lib/protocol/websocket/text_frame.rb

Constant Summary collapse

OPCODE =
0x1

Instance Attribute Summary

Attributes inherited from Frame

#finished, #length, #mask, #opcode, #payload

Instance Method Summary collapse

Methods inherited from Frame

#<=>, #continued?, #control?, #finished?, #initialize, parse_header, read, #to_ary, #write

Constructor Details

This class inherits a constructor from Protocol::WebSocket::Frame

Instance Method Details

#apply(connection) ⇒ Object



40
41
42
# File 'lib/protocol/websocket/text_frame.rb', line 40

def apply(connection)
	connection.receive_text(self)
end

#data?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/protocol/websocket/text_frame.rb', line 28

def data?
	true
end

#pack(data) ⇒ Object



36
37
38
# File 'lib/protocol/websocket/text_frame.rb', line 36

def pack(data)
	super(data.b)
end

#unpackObject



32
33
34
# File 'lib/protocol/websocket/text_frame.rb', line 32

def unpack
	super.force_encoding(Encoding::UTF_8)
end