Wrench\Frame\Frame¶
-
class
Frame
¶ Represents a WebSocket frame
-
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()
-
getLength
()¶ Gets the length of the payload
Returns: int
-
encode
($data, $type = Protocol::TYPE_TEXT, $masked = false)¶ Resets the frame and encodes the given data into it
Parameters: - $data (string) –
- $type (int) –
- $masked (boolean) –
Returns: Frame
-
isFinal
()¶ Whether the frame is the final one in a continuation
Returns: boolean
-
getType
()¶ Returns: int
-
decodeFramePayloadFromBuffer
()¶ Decodes a frame payload from the buffer
Returns: void
-
getExpectedBufferLength
()¶ Gets the expected length of the buffer once all the data has been receieved
Returns: int
-
isComplete
()¶ Whether the frame is complete
Returns: boolean
-
receiveData
($data)¶ Receieves data into the frame
Parameters: - $data –
-
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
-
property