Frame

Description

A WebSocket frame.

See also
Base Framing Protocol
Defined Status Codes

Public Properties

const CLOSE_BAD_DATA = 1007
 
const CLOSE_EXPECTATION = 1010
 
const CLOSE_INTERNAL_ERROR = 1011
 
const CLOSE_INTERRUPT = 1001
 
const CLOSE_NORMAL = 1000
 
const CLOSE_POLICY_VIOLATION = 1008
 
const CLOSE_PROTOCOL_ERROR = 1002
 
const CLOSE_TOO_LARGE = 1009
 
const CLOSE_UNHANDLED_DATA = 1003
 
const FIN = 0x80
 
const LEN = 0x7f
 
const NAMES
 
const OP = 0x0f
 
const OP_BINARY = 0x02
 
const OP_CLOSE = 0x08
 
const OP_CONTINUATION = 0x00
 
const OP_PING = 0x09
 
const OP_PONG = 0x0a
 
const OP_TEXT = 0x01
 
const RSV1 = 0x40
 
const RSV123 = 0x70
 
const RSV2 = 0x20
 
const RSV3 = 0x10
 

Protected Properties

bool $final
 
int $opCode
 
string $payload
 
int $rsv
 The RSV bits masked out of the first byte of the frame, as-is. More...
 

Public Methods

 __construct (bool $final, int $rsv, int $opCode, string $payload)
 
string __toString ()
 The payload, or CLOSE reason. More...
 
int getCloseCode ()
 The CLOSE code. More...
 
string getCloseReason ()
 The CLOSE reason. More...
 
int getLength ()
 
string getName ()
 
int getOpCode ()
 
string getPayload ()
 
int getRsv ()
 
bool hasRsv1 ()
 
bool hasRsv2 ()
 
bool hasRsv3 ()
 
bool isBinary ()
 
bool isClose ()
 
bool isContinuation ()
 
bool isControl ()
 
bool isData ()
 
bool isFinal ()
 
bool isPing ()
 
bool isPong ()
 
bool isText ()
 

Properties

◆ $rsv

int $rsv
protected

The RSV bits masked out of the first byte of the frame, as-is.

◆ NAMES

const NAMES
Initial value:
= [
self::OP_CONTINUATION => 'CONTINUATION',
self::OP_TEXT => 'TEXT',
self::OP_BINARY => 'BINARY',
0x03 => 'RESERVED DATA 0x03',
0x04 => 'RESERVED DATA 0x04',
0x05 => 'RESERVED DATA 0x05',
0x06 => 'RESERVED DATA 0x06',
0x07 => 'RESERVED DATA 0x07',
self::OP_CLOSE => 'CLOSE',
self::OP_PING => 'PING',
self::OP_PONG => 'PONG',
0x0b => 'RESERVED CONTROL 0x0b',
0x0c => 'RESERVED CONTROL 0x0c',
0x0d => 'RESERVED CONTROL 0x0d',
0x0e => 'RESERVED CONTROL 0x0e',
0x0f => 'RESERVED CONTROL 0x0f',
]

Constructor

◆ __construct()

__construct ( bool  $final,
int  $rsv,
int  $opCode,
string  $payload 
)
Parameters
bool$final
int$rsv
int$opCode
string$payload

Methods

◆ __toString()

string __toString ( )

The payload, or CLOSE reason.

Returns
string

◆ getCloseCode()

int getCloseCode ( )
final

The CLOSE code.

See also
https://tools.ietf.org/html/rfc6455#section-5.5.1
Returns
int

◆ getCloseReason()

string getCloseReason ( )
final

The CLOSE reason.

See also
https://tools.ietf.org/html/rfc6455#section-5.5.1
Returns
string

◆ getLength()

int getLength ( )
final
Returns
int

◆ getName()

string getName ( )
Returns
string

◆ getOpCode()

int getOpCode ( )
final
Returns
int

◆ getPayload()

string getPayload ( )
final
Returns
string

◆ getRsv()

int getRsv ( )
final
Returns
int

◆ hasRsv1()

bool hasRsv1 ( )
final
Returns
bool

◆ hasRsv2()

bool hasRsv2 ( )
final
Returns
bool

◆ hasRsv3()

bool hasRsv3 ( )
final
Returns
bool

◆ isBinary()

bool isBinary ( )
final
Returns
bool

◆ isClose()

bool isClose ( )
final
Returns
bool

◆ isContinuation()

bool isContinuation ( )
final
Returns
bool

◆ isControl()

bool isControl ( )
final
Returns
bool

◆ isData()

bool isData ( )
final
Returns
bool

◆ isFinal()

bool isFinal ( )
final
Returns
bool

◆ isPing()

bool isPing ( )
final
Returns
bool

◆ isPong()

bool isPong ( )
final
Returns
bool

◆ isText()

bool isText ( )
final
Returns
bool