Class: Hyperion::WebSocket::Frame

Inherits:
Struct
  • Object
show all
Defined in:
lib/hyperion/websocket/frame.rb

Overview

Per-message struct returned by ‘Parser.parse`. `opcode` is a Symbol (`:text`, `:binary`, …); `payload` is a freshly-allocated binary String already unmasked. `rsv1` is the per-message-deflate marker (RFC 7692 §6); always false on parsed control frames (the parser would have errored out), only ever true on text/binary/ continuation frames when the connection negotiated the extension.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fin:, opcode:, payload:, rsv1: false) ⇒ Frame

Defaults — keep ‘Frame.new(fin:, opcode:, payload:)` working for the (overwhelming) majority of call sites that don’t care about rsv1. New WS-2.3 callers pass ‘rsv1:` explicitly when building a compressed frame.



40
41
42
# File 'lib/hyperion/websocket/frame.rb', line 40

def initialize(fin:, opcode:, payload:, rsv1: false)
  super(fin: fin, opcode: opcode, payload: payload, rsv1: rsv1)
end

Instance Attribute Details

#finObject

Returns the value of attribute fin

Returns:

  • (Object)

    the current value of fin



35
36
37
# File 'lib/hyperion/websocket/frame.rb', line 35

def fin
  @fin
end

#opcodeObject

Returns the value of attribute opcode

Returns:

  • (Object)

    the current value of opcode



35
36
37
# File 'lib/hyperion/websocket/frame.rb', line 35

def opcode
  @opcode
end

#payloadObject

Returns the value of attribute payload

Returns:

  • (Object)

    the current value of payload



35
36
37
# File 'lib/hyperion/websocket/frame.rb', line 35

def payload
  @payload
end

#rsv1Object

Returns the value of attribute rsv1

Returns:

  • (Object)

    the current value of rsv1



35
36
37
# File 'lib/hyperion/websocket/frame.rb', line 35

def rsv1
  @rsv1
end