Browse Source

修改websocket

yingzi 2 years ago
parent
commit
ba1efcea5b
1 changed files with 15 additions and 5 deletions
  1. 15 5
      Mall/Framework/Swoole/WebsocketClient.Class.php

+ 15 - 5
Mall/Framework/Swoole/WebsocketClient.Class.php

@@ -116,14 +116,24 @@ class WebSocketClient
     {
         if (extension_loaded('swoole'))
         {
-            $type = SWOOLE_TCP;
-            if ($this->ssl)
-            {
-                $type |= SWOOLE_SSL;
+//            $type = SWOOLE_TCP;
+//            if ($this->ssl)
+//            {
+//                $type |= SWOOLE_SSL;
+//            }
+//            $this->socket = new \swoole_client($type);
+            if($this->ssl){
+                $this->socket = new \swoole_client(SWOOLE_SOCK_TCP | SWOOLE_SSL);
+            }else{
+                $this->socket = new \swoole_client(SWOOLE_SOCK_TCP);
             }
-            $this->socket = new \swoole_client($type);
+            
+            
+            
             if ($this->ssl_key_file)
             {
+                var_dump($this->ssl_cert_file);
+                var_dump("xxaa");
                 $this->socket->set(array(
                     'ssl_key_file' => $this->ssl_key_file,
                     'ssl_cert_file' => $this->ssl_cert_file,