class WebSocket::Frame::Incoming
frame.next # “world!”“
frame.next # ”Hello“
frame << ”x81x05x48x65x6cx6cx6fx81x06x77x6fx72x6cx64x21“
frame = WebSocket::Frame::Incoming::Server.new(version: @handshake.version)
@example
@note You should NEVER use this class directly - use Client or Server subclasses instead, as they contain additional frame options(i.e. Client-side masking in draft 04)
Construct or parse incoming WebSocket Frame.
def <<(data)
-
data
(String
) -- Raw frame
def <<(data) @data << data end
def decoded?
-
(Boolean)
- If frame already decoded?
def decoded? @decoded end
def initialize(args = {})
def initialize(args = {}) @decoded = args[:decoded] || false super end
def next
-
(WebSocket::Frame::Incoming)
- Single incoming frame or nil if no complete frame is available.
def next @handler.decode_frame unless decoded? end
def to_s
-
(String)
- Data of frame
def to_s @data end