|
@@ -115,7 +115,8 @@ class Websocket implements \Workerman\Protocols\ProtocolInterface
|
|
|
// 如果有设置onWebSocketClose回调,尝试执行
|
|
// 如果有设置onWebSocketClose回调,尝试执行
|
|
|
if(isset($connection->onWebSocketClose))
|
|
if(isset($connection->onWebSocketClose))
|
|
|
{
|
|
{
|
|
|
- call_user_func(array($connection, 'onWebSocketClose'), $connection);
|
|
|
|
|
|
|
+ $func = $connection->onWebSocketClose;
|
|
|
|
|
+ call_user_func($func, $connection);
|
|
|
}
|
|
}
|
|
|
// 默认行为是关闭连接
|
|
// 默认行为是关闭连接
|
|
|
else
|
|
else
|
|
@@ -128,12 +129,13 @@ class Websocket implements \Workerman\Protocols\ProtocolInterface
|
|
|
// 如果有设置onWebSocketPing回调,尝试执行
|
|
// 如果有设置onWebSocketPing回调,尝试执行
|
|
|
if(isset($connection->onWebSocketPing))
|
|
if(isset($connection->onWebSocketPing))
|
|
|
{
|
|
{
|
|
|
- call_user_func(array($connection, 'onWebSocketPing'), $connection);
|
|
|
|
|
|
|
+ $func = $connection->onWebSocketPing;
|
|
|
|
|
+ call_user_func($func, $connection);
|
|
|
}
|
|
}
|
|
|
// 默认发送pong
|
|
// 默认发送pong
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- $connection->send(pack('H*', '8a00'));
|
|
|
|
|
|
|
+ $connection->send(pack('H*', '8a00'), true);
|
|
|
}
|
|
}
|
|
|
// 从接受缓冲区中消费掉该数据包
|
|
// 从接受缓冲区中消费掉该数据包
|
|
|
if(!$data_len)
|
|
if(!$data_len)
|
|
@@ -147,7 +149,8 @@ class Websocket implements \Workerman\Protocols\ProtocolInterface
|
|
|
// 如果有设置onWebSocketPong回调,尝试执行
|
|
// 如果有设置onWebSocketPong回调,尝试执行
|
|
|
if(isset($connection->onWebSocketPong))
|
|
if(isset($connection->onWebSocketPong))
|
|
|
{
|
|
{
|
|
|
- call_user_func(array($connection, 'onWebSocketPong'), $connection);
|
|
|
|
|
|
|
+ $func = $connection->onWebSocketPong;
|
|
|
|
|
+ call_user_func($func, $connection);
|
|
|
}
|
|
}
|
|
|
// 从接受缓冲区中消费掉该数据包
|
|
// 从接受缓冲区中消费掉该数据包
|
|
|
if(!$data_len)
|
|
if(!$data_len)
|