\Workerman\ProtocolsWs

Websocket protocol for client.

Summary

Methods
Properties
Constants
input()
encode()
decode()
onConnect()
onClose()
sendHandshake()
dealHandshake()
WSSetProtocol()
WSGetServerProtocol()
No public properties found
BINARY_TYPE_BLOB
BINARY_TYPE_ARRAYBUFFER
No protected methods found
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\Protocols\ConnectionInterface  $connection) : integer

Check the integrity of the package.

Parameters

string $buffer
\Workerman\Protocols\ConnectionInterface $connection

Returns

integer

encode()

encode(  $payload, \Workerman\Protocols\ConnectionInterface  $connection) : string

Websocket encode.

Parameters

$payload
\Workerman\Protocols\ConnectionInterface $connection

Returns

string

decode()

decode(  $bytes, \Workerman\Protocols\ConnectionInterface  $connection) : string

Websocket decode.

Parameters

$bytes
\Workerman\Protocols\ConnectionInterface $connection

Returns

string

onConnect()

onConnect(  $connection) : void

Send websocket handshake data.

Parameters

$connection

onClose()

onClose(  $connection) 

Clean

Parameters

$connection

dealHandshake()

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

Websocket handshake.

Parameters

string $buffer
\Workerman\Connection\TcpConnection $connection

Returns

integer

WSSetProtocol()

WSSetProtocol(  $connection,   $params) 

Parameters

$connection
$params

WSGetServerProtocol()

WSGetServerProtocol(  $connection) 

Parameters

$connection