|
|
@@ -201,7 +201,7 @@ class Websocket implements \Workerman\Protocols\ProtocolInterface
|
|
|
public static function encode($buffer, ConnectionInterface $connection)
|
|
|
{
|
|
|
$len = strlen($buffer);
|
|
|
- if(empty($connection->websocketHandshake))
|
|
|
+ if(empty($connection->websocketType))
|
|
|
{
|
|
|
// 默认是utf8文本格式
|
|
|
$connection->websocketType = self::BINARY_TYPE_BLOB;
|
|
|
@@ -331,7 +331,10 @@ class Websocket implements \Workerman\Protocols\ProtocolInterface
|
|
|
$connection->tmpWebsocketData = '';
|
|
|
}
|
|
|
// blob or arraybuffer
|
|
|
- $connection->websocketType = self::BINARY_TYPE_BLOB;
|
|
|
+ if(empty($connection->websocketType))
|
|
|
+ {
|
|
|
+ $connection->websocketType = self::BINARY_TYPE_BLOB;
|
|
|
+ }
|
|
|
// 如果有设置onWebSocketConnect回调,尝试执行
|
|
|
if(isset($connection->onWebSocketConnect))
|
|
|
{
|