class Frame
Definitions
def initialize(finished = true, payload = nil, flags: 0, opcode: self.class::OPCODE, mask: false)
Signature
-
parameter
length
Integer
The length of the payload, or nil if the header has not been read yet.
-
parameter
mask
Boolean | String
An optional 4-byte string which is used to mask the payload.
Implementation
def initialize(finished = true, payload = nil, flags: 0, opcode: self.class::OPCODE, mask: false)
if mask == true
mask = SecureRandom.bytes(4)
end
@finished = finished
@flags = flags
@opcode = opcode
@mask = mask
@length = payload&.bytesize
@payload = payload
end
def data?
Signature
-
returns
Boolean
if the frame contains data.
Implementation
def data?
false
end