Bladeren bron

3.2.4 fix connection->websocketType

walkor 10 jaren geleden
bovenliggende
commit
9a12a5188d
2 gewijzigde bestanden met toevoegingen van 6 en 3 verwijderingen
  1. 5 2
      Protocols/Websocket.php
  2. 1 1
      Worker.php

+ 5 - 2
Protocols/Websocket.php

@@ -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))
             {

+ 1 - 1
Worker.php

@@ -34,7 +34,7 @@ class Worker
      * 版本号
      * @var string
      */
-    const VERSION = '3.2.3';
+    const VERSION = '3.2.4';
     
     /**
      * 状态 启动中