Class: WebSocketRb::Wrapper::FrameOutgoing
- Defined in:
- lib/web_socket_rb/wrapper/frame_outgoing.rb
Direct Known Subclasses
Constant Summary
Constants inherited from FrameBase
WebSocketRb::Wrapper::FrameBase::BINARY, WebSocketRb::Wrapper::FrameBase::CLOSE, WebSocketRb::Wrapper::FrameBase::CONTINUATION, WebSocketRb::Wrapper::FrameBase::PING, WebSocketRb::Wrapper::FrameBase::PONG, WebSocketRb::Wrapper::FrameBase::TEXT
Instance Attribute Summary
Attributes inherited from FrameBase
#fin, #mask, #masking_key, #opcode, #payload_data, #payload_len, #rsv1, #rsv2, #rsv3
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ FrameOutgoing
constructor
A new instance of FrameOutgoing.
Methods inherited from FrameBase
#destination, #message, #to_bytes
Constructor Details
#initialize(options = {}) ⇒ FrameOutgoing
Returns a new instance of FrameOutgoing.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/web_socket_rb/wrapper/frame_outgoing.rb', line 7 def initialize( = {}) @payload_data = .fetch(:payload_data, '') @payload_len = @payload_data.bytes.size @fin = .fetch(:fin, true) @rsv1 = .fetch(:rsv1, false) # No externals (false by default) @rsv2 = .fetch(:rsv2, false) # No externals (false by default) @rsv3 = .fetch(:rsv3, false) # No externals (false by default) @opcode = .fetch(:opcode, CONTINUATION) # Type of frame (continuation by default) @mask = .fetch(:mask, false) # Mask (false by default) @masking_key = Random.new.bytes(4) if @mask # Generate random masking key if mask end |