Class: Hyperion::WebSocket::Frame
- Inherits:
-
Struct
- Object
- Struct
- Hyperion::WebSocket::Frame
- 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
-
#fin ⇒ Object
Returns the value of attribute fin.
-
#opcode ⇒ Object
Returns the value of attribute opcode.
-
#payload ⇒ Object
Returns the value of attribute payload.
-
#rsv1 ⇒ Object
Returns the value of attribute rsv1.
Instance Method Summary collapse
-
#initialize(fin:, opcode:, payload:, rsv1: false) ⇒ Frame
constructor
Defaults — keep ‘Frame.new(fin:, opcode:, payload:)` working for the (overwhelming) majority of call sites that don’t care about rsv1.
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
#fin ⇒ Object
Returns the value of attribute fin
35 36 37 |
# File 'lib/hyperion/websocket/frame.rb', line 35 def fin @fin end |
#opcode ⇒ Object
Returns the value of attribute opcode
35 36 37 |
# File 'lib/hyperion/websocket/frame.rb', line 35 def opcode @opcode end |
#payload ⇒ Object
Returns the value of attribute payload
35 36 37 |
# File 'lib/hyperion/websocket/frame.rb', line 35 def payload @payload end |
#rsv1 ⇒ Object
Returns the value of attribute rsv1
35 36 37 |
# File 'lib/hyperion/websocket/frame.rb', line 35 def rsv1 @rsv1 end |