Class: Protocol::WebSocket::CloseFrame

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

Constant Summary collapse

OPCODE =
0x8
FORMAT =
"na*"

Instance Attribute Summary

Attributes inherited from Frame

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

Instance Method Summary collapse

Methods inherited from Frame

#<=>, #continued?, #control?, #data?, #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



39
40
41
# File 'lib/protocol/websocket/close_frame.rb', line 39

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

#pack(code, reason) ⇒ Object



35
36
37
# File 'lib/protocol/websocket/close_frame.rb', line 35

def pack(code, reason)
	super [code, reason].pack(FORMAT)
end

#unpackObject



29
30
31
32
33
# File 'lib/protocol/websocket/close_frame.rb', line 29

def unpack
	data = super
	
	return data.unpack(FORMAT)
end