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