Метод |
Описание |
|
afterResponse ( Request $request, Response $response ) |
Clean and fire onWsConnect(). |
|
cleanBuffer ( $fd ) |
清理连接缓存区 |
|
cleanConnection ( ) |
clean all connection |
|
close ( integer $fd, integer $code = self::CLOSE_NORMAL, string $reason = '' ) : boolean |
Close a connection. |
|
doHandshake ( Request $request, Response $response ) : boolean |
Do the handshake. |
|
newFrame ( string $message, integer $opcode = self::OPCODE_TEXT_FRAME, boolean $end = true ) : integer |
Write a frame. |
|
onClose ( $serv, $client_id, $from_id ) |
|
|
onConnect ( $serv, $fd, $from_id ) |
|
|
onEnter ( $client_id ) |
|
|
onExit ( $client_id ) : mixed |
客户端退出 |
|
onHttpRequest ( Request $request ) : Response |
Produce response for Http request. |
|
onMessage ( $client_id, $message ) : mixed |
收到消息 |
|
onReceive ( $server, $fd, $from_id, $data ) |
Read a frame. |
|
onRequest ( Request $request ) : Response |
Request come |
|
onWebSocketRequest ( Request $request ) : Response |
Produce response for WebSocket request. |
|
onWsConnect ( $client_id, $request ) |
Called on WebSocket connection established. |
|
opcodeSwitch ( $client_id, &$ws ) |
opcode switch |
|
parseFrame ( &$buffer ) : array | boolean |
解析数据帧
返回false表示解析失败,需要关闭此连接 |
|
send ( integer $client_id, string $message, integer $opcode = self::OPCODE_TEXT_FRAME, boolean $end = true ) : boolean |
Send a message. |
|