Files
2026-08-11 22:22:10 +08:00

107 lines
3.3 KiB
PHP

<?php
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', 20108),
'mode' => SWOOLE_PROCESS,
'sock_type' => SWOOLE_SOCK_TCP,
'options' => [
'pid_file' => runtime_path() . 'swoole.pid',
'log_file' => runtime_path() . 'swoole.log',
'daemonize' => false,
'reactor_num' => swoole_cpu_num() * 2,
'worker_num' => swoole_cpu_num() * 2,
'task_worker_num' => swoole_cpu_num() * 2,
'task_enable_coroutine' => true,
'enable_static_handler' => true,
'document_root' => root_path('public'),
'package_max_length' => 20 * 1024 * 1024,
'buffer_output_size' => 10 * 1024 * 1024,
'socket_buffer_size' => 128 * 1024 * 1024,
],
],
'websocket' => [
'enable' => true,
'handler' => Manager::class,
'parser' => Parser::class,
'ping_interval' => 25000,
'ping_timeout' => 60000,
'room' => [
'type' => 'table',
'table' => [
'room_rows' => 4096,
'room_size' => 2048,
'client_rows' => 8192,
'client_size' => 2048,
],
'redis' => [
'host' => '127.0.0.1',
'port' => 6379,
'max_active' => 10,
'max_wait_time' => 5,
],
],
'listen' => [],
'subscribe' => [],
],
'rpc' => [
'server' => [
'enable' => false,
'port' => 9000,
'services' => [],
],
'client' => [],
],
'hot_update' => [
'enable' => env('APP_DEBUG', false),
'name' => ['*.php'],
'include' => [app_path(), root_path('crmeb')],
'exclude' => [],
],
'pool' => [
'db' => [
'enable' => true,
'max_active' => 3,
'max_wait_time' => 5,
],
'cache' => [
'enable' => true,
'max_active' => 3,
'max_wait_time' => 5,
],
],
'coroutine' => [
'enable' => false,
'flags' => SWOOLE_HOOK_ALL | SWOOLE_HOOK_CURL,
],
'tables' => [
'user' => [
'size' => 2048 * 50,
'columns' => [
['name' => 'fd', 'type' => Table::TYPE_INT],
['name' => 'type', 'size' => 1024, 'type' => Table::TYPE_STRING],
['name' => 'user_id', 'type' => Table::TYPE_INT],
['name' => 'to_user_id', 'type' => Table::TYPE_INT],
['name' => 'tourist', 'type' => Table::TYPE_INT],
['name' => 'is_open', 'type' => Table::TYPE_INT],
['name' => 'appid', 'size' => 1024, 'type' => Table::TYPE_STRING],
]
]
],
'queue' => [
'enable' => true,
'workers' => [
'CRMEB_CHAT' => [],
],
],
'concretes' => [],
'resetters' => [],
'instances' => [],
'services' => [],
];