\Workerman\ProtocolsWebsocket

WebSocket protocol.

Summary

Methods
Properties
Constants
input()
encode()
decode()
No public properties found
BINARY_TYPE_BLOB
BINARY_TYPE_ARRAYBUFFER
dealHandshake()
parseHttpHeader()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

BINARY_TYPE_BLOB

BINARY_TYPE_BLOB = "\x81" : string

Websocket blob type.

BINARY_TYPE_ARRAYBUFFER

BINARY_TYPE_ARRAYBUFFER = "\x82" : string

Websocket arraybuffer type.

Methods

input()

input(string  $buffer, \Workerman\Connection\ConnectionInterface  $connection) : integer

Check the integrity of the package.

Please return the length of package. If length is unknow please return 0 that mean wating more data. If the package has something wrong please return false the connection will be closed.

Parameters

string $buffer
\Workerman\Connection\ConnectionInterface $connection

Returns

integer

encode()

encode(string  $buffer, \Workerman\Connection\ConnectionInterface  $connection) : string

Websocket encode.

Parameters

string $buffer
\Workerman\Connection\ConnectionInterface $connection

Returns

string

decode()

decode(string  $buffer, \Workerman\Connection\ConnectionInterface  $connection) : string

Websocket decode.

Parameters

string $buffer
\Workerman\Connection\ConnectionInterface $connection

Returns

string

dealHandshake()

dealHandshake(string  $buffer, \Workerman\Connection\TcpConnection  $connection) : integer

Websocket handshake.

Parameters

string $buffer
\Workerman\Connection\TcpConnection $connection

Returns

integer

parseHttpHeader()

parseHttpHeader(string  $buffer) : void

Parse http header.

Parameters

string $buffer