Class: Lich::Common::WebSocket::Frame::Message

Inherits:
Struct
  • Object
show all
Defined in:
documented/common/websocket/frame.rb

Overview

A single reassembled message (data: :text/:binary with any continuation frames already merged; control: :close/:ping/:pong, always a single frame per RFC 6455 5.5).

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#opcode ⇒ Object

Returns the value of attribute opcode

Returns:

  • (Object) —

    the current value of opcode



44
45
46
# File 'documented/common/websocket/frame.rb', line 44

def opcode
  @opcode
end

#payload ⇒ Object

Returns the value of attribute payload

Returns:

  • (Object) —

    the current value of payload



44
45
46
# File 'documented/common/websocket/frame.rb', line 44

def payload
  @payload
end

Instance Method Details

#control? ⇒ Boolean

Returns true if this message is a control frame (close, ping, or pong).

Returns:

  • (Boolean)


55
56
57
# File 'documented/common/websocket/frame.rb', line 55

def control?
  CONTROL_OPCODES.include?(opcode)
end

#data? ⇒ Boolean

Returns true if this message is a data frame (text or binary), excluding continuation frames.

Returns:

  • (Boolean)


48
49
50
# File 'documented/common/websocket/frame.rb', line 48

def data?
  DATA_OPCODES.include?(opcode) && opcode != OPCODE_CONTINUATION
end