Wrench\Frame\HybiFrame

class HybiFrame
property masked

protected boolean

Whether the payload is masked

property mask

protected string

Masking key

property offset_payload

protected int

Byte offsets

property offset_mask

protected

property length

protected int

The frame data length

property type

protected int

The type of this payload

property buffer

protected string

The buffer

May not be a complete payload, because this frame may still be receiving data. See

property payload

protected string

The enclosed frame payload

May not be a complete payload, because this frame might indicate a continuation frame. See isFinal() versus isComplete()

encode($payload, $type = Protocol::TYPE_TEXT, $masked = false)
Parameters:
  • $payload
  • $type
  • $masked
mask($payload)

Masks/Unmasks the frame

Parameters:
  • $payload (string) –
Returns:

string

unmask($payload)

Masks a payload

Parameters:
  • $payload (string) –
Returns:

string

receiveData($data)
Parameters:
  • $data
getMask()

Gets the mask

Returns:string
generateMask()

Generates a suitable masking key

Returns:string
isMasked()

Whether the frame is masked

Returns:boolean
getExpectedBufferLength()
getPayloadOffset()

Gets the offset of the payload in the frame

Returns:int
getMaskOffset()

Gets the offset in the frame to the masking bytes

Returns:int
getLength()
getInitialLength()

Gets the inital length value, stored in the first length byte

This determines how the rest of the length value is parsed out of the frame.

Returns:int
getLengthSize()

Returns the byte size of the length part of the frame

Not including the initial 7 bit part

Returns:int
getMaskSize()

Returns the byte size of the mask part of the frame

Returns:int
decodeFramePayloadFromBuffer()
isFinal()
getType()
isComplete()

Whether the frame is complete

Returns:boolean
getRemainingData()

Gets the remaining number of bytes before this frame will be complete

Returns:number
isWaitingForData()

Whether this frame is waiting for more data

Returns:boolean
getFramePayload()

Gets the contents of the frame payload

The frame must be complete to call this method.

Returns:string
getFrameBuffer()

Gets the contents of the frame buffer

This is the encoded value, receieved into the frame with recieveData().

Returns:string binary
getBufferLength()

Gets the expected length of the frame payload

Returns:int