Handshake

Description

Initial WebSocket connection handshake.

https://tools.ietf.org/html/rfc6455#section-1.3

Public Properties

const RFC_GUID = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'
 

Protected Properties

string $buffer = ''
 
WebSocketClient $client
 
string[][] $headers = []
 [ header name => lowercase value => actual value ] More...
 
int $maxLength = 4096
 The connection is closed (HTTP 413) if the received headers exceed this many bytes. More...
 
string $method
 

Public Methods

 __construct (WebSocketClient $client)
 
string[][] getHeaders ()
 
string getMethod ()
 
bool onReadable ()
 Negotiates the initial connection. More...
 

Protected Methods

void upgrade ()
 Sends the connection upgrade headers. More...
 
void validate ()
 Validates the received HTTP handshake headers, or throws. More...
 

Properties

◆ $headers

string [][] $headers = []
protected

[ header name => lowercase value => actual value ]

◆ $maxLength

int $maxLength = 4096
protected

The connection is closed (HTTP 413) if the received headers exceed this many bytes.

Constructor

◆ __construct()

__construct ( WebSocketClient  $client)
Parameters
WebSocketClient$client

Methods

◆ getHeaders()

string [][] getHeaders ( )
Returns
string[][]

◆ getMethod()

string getMethod ( )
Returns
string

◆ onReadable()

bool onReadable ( )

Negotiates the initial connection.

Returns
bool
Exceptions
WebSocketError
Throwable

◆ upgrade()

void upgrade ( )
protected

Sends the connection upgrade headers.

◆ validate()

void validate ( )
protected

Validates the received HTTP handshake headers, or throws.

Exceptions
WebSocketError