zxhxx 3 лет назад
Родитель
Сommit
af2300802d
1 измененных файлов с 30 добавлено и 30 удалено
  1. 30 30
      config/swoole.php

+ 30 - 30
config/swoole.php

@@ -4,21 +4,17 @@
 
 use app\webscoket\Manager;
 use Swoole\Table;
-use think\swoole\websocket\socketio\Parser;
-
 return [
-    'server'     => [
-        'host'      => env('SWOOLE_HOST', '0.0.0.0'), // 监听地址
-        'port'      => env('SWOOLE_PORT', 8324), // 监听端口
-        'mode'      => SWOOLE_PROCESS, // 运行模式 默认为SWOOLE_PROCESS
-        'sock_type' => SWOOLE_SOCK_TCP, // sock type 默认为SWOOLE_SOCK_TCP
-        'options'   => [
+    'http'       => [
+        'enable'     => true,
+        'host'       => '0.0.0.0',
+        'port'       => 8365,
+        'worker_num' => swoole_cpu_num(),
+        'options'    => [
             'pid_file'              => runtime_path() . 'swoole.pid',
             'log_file'              => runtime_path() . 'swoole.log',
             'daemonize'             => false,
-            // Normally this value should be 1~4 times larger according to your cpu cores.
             'reactor_num'           => swoole_cpu_num(),
-            'worker_num'            => swoole_cpu_num(),
             'task_worker_num'       => swoole_cpu_num(),
             'task_enable_coroutine' => false,
             'task_max_request'      => 2000,
@@ -33,21 +29,23 @@ return [
         ],
     ],
     'websocket'  => [
-        'enable'        => true,
+        'enable'        => false,
         'handler'       => Manager::class,
-        'parser'        => Parser::class,
-        'ping_interval' => 25000, //1000 = 1秒
-        'ping_timeout'  => 60000, //1000 = 1秒
+        'ping_interval' => 25000,
+        'ping_timeout'  => 60000,
         'room'          => [
             'type'  => 'table',
             'table' => [
-                'room_rows'   => 4096,
+                'room_rows'   => 8192,
                 'room_size'   => 2048,
-                'client_rows' => 8192,
+                'client_rows' => 4096,
                 'client_size' => 2048,
             ],
             'redis' => [
-
+                'host'          => '127.0.0.1',
+                'port'          => 6379,
+                'max_active'    => 3,
+                'max_wait_time' => 5,
             ],
         ],
         'listen'        => [],
@@ -55,18 +53,23 @@ return [
     ],
     'rpc'        => [
         'server' => [
-            'enable'   => false,
-            'port'     => 9000,
-            'services' => [
-            ],
-        ],
-        'client' => [
+            'enable'     => false,
+            'host'       => '0.0.0.0',
+            'port'       => 9000,
+            'worker_num' => swoole_cpu_num(),
+            'services'   => [],
         ],
+        'client' => [],
+    ],
+    //队列
+    'queue'      => [
+        'enable'  => false,
+        'workers' => [],
     ],
     'hot_update' => [
         'enable'  => env('APP_DEBUG', false),
         'name'    => ['*.php'],
-        'include' => [app_path(),root_path().'crmeb'],
+        'include' => [app_path(),root_path().'ln'],
         'exclude' => [],
     ],
     //连接池
@@ -81,12 +84,9 @@ return [
             'max_active'    => 3,
             'max_wait_time' => 5,
         ],
+        //自定义连接池
     ],
-    'coroutine'  => [
-        'enable' => false,
-        'flags'  => SWOOLE_HOOK_ALL,
-    ],
-    'tables' => [
+    'tables'     => [
         'user' => [
             'size' => 2048,
             'columns' => [
@@ -104,5 +104,5 @@ return [
     'instances'  => [],
     //每次请求前需要重新执行的服务
     'services'   => [],
-    'locks' => ['group_buying'],
 ];
+