[ 'host' => env('SWOOLE_HOST', '0.0.0.0'), // 监听地址 'port' => env('SWOOLE_PORT', 8082), // 监听端口 'mode' => SWOOLE_PROCESS, // 运行模式 默认为SWOOLE_PROCESS 'sock_type' => SWOOLE_SOCK_TCP, // sock type 默认为SWOOLE_SOCK_TCP 'options' => [ 'pid_file' => runtime_path() . 'swoole.pid', 'log_file' => runtime_path() . 'swoole.log', 'daemonize' => env('SWOOLE_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(), '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' => Handler::class, 'parser' => Parser::class, 'ping_interval' => 1000, 'ping_timeout' => 1000, 'room' => [ 'type' => 'redis', 'table' => [ 'room_rows' => 40960, 'room_size' => 20480, 'client_rows' => 81920, 'client_size' => 20480, ], 'redis' => [ 'host' => '127.0.0.1', 'port' => 6379, 'max_active' => 3, 'max_wait_time' => 5, ], ], 'listen' => [ /* 连接事件 */ 'Connect' => '\app\listener\WsConnect', /* 关闭事件 */ 'Close' => '\app\listener\WsClose', /* 获取当前状态事件,测试使用 */ 'getState' => '\app\listener\GetState', /* 操作事件 */ 'startBet' => '\app\listener\space\StartBet', 'endBet' => '\app\listener\space\EndBet', 'startRob' => '\app\listener\space\StartRob', 'endRob' => '\app\listener\space\EndRob', 'changeBoot' => '\app\listener\space\ChangeBoot', 'resetBoot' => '\app\listener\space\ResetBoot', 'resetNumberTab' => '\app\listener\space\ResetNumberTab', 'resetBaccarat' => '\app\listener\space\ResetBaccarat', 'resetDt' => '\app\listener\space\ResetDt', 'openingDt' => '\app\listener\space\OpeningDt', 'openingBaccarat' => '\app\listener\space\OpeningBaccarat', 'openingNn' => '\app\listener\space\OpeningNn', 'openingTc' => '\app\listener\space\OpeningTc', 'openingToning' => '\app\listener\space\OpeningToning', 'openingDice' => '\app\listener\space\OpeningDice', 'openingRoulette' => '\app\listener\space\openingRoulette', /* 扫描事件 */ 'sendScanBaccarat' => '\app\listener\scan\Baccarat', 'sendScanDt' => '\app\listener\scan\Dt', 'sendScanNn' => '\app\listener\scan\Nn', 'sendScanTc' => '\app\listener\scan\Tc', 'checkScanStatus' => '\app\listener\scan\CheckScanStatus', /* 修改事件 */ 'sendScanChangeNnResult' => '\app\listener\scan\NnChange', /* 会员事件 */ 'toBet' => '\app\listener\user\ToBet', 'cancelBet' => '\app\listener\user\CancelBet', 'toRob' => '\app\listener\user\ToRob', 'toSeat' => '\app\listener\user\ToSeat', 'toLeaveSeat' => '\app\listener\user\ToLeaveSeat', /* 在线客服事件 */ 'chat.connect' => '\app\listener\chat\ChatConnect', 'chat.ping' => '\app\listener\chat\ChatPing', 'chat.message.send' => '\app\listener\chat\ChatMessageSend', 'chat.message.ack' => '\app\listener\chat\ChatMessageAck', 'chat.typing' => '\app\listener\chat\ChatTyping', 'chat.session.end' => '\app\listener\chat\ChatSessionEnd', 'chat.session.rate' => '\app\listener\chat\ChatSessionRate', 'chat.session.transfer' => '\app\listener\chat\ChatSessionTransfer', 'chat.agent.online' => '\app\listener\chat\ChatAgentOnline', 'chat.agent.offline' => '\app\listener\chat\ChatAgentOffline', 'chat.queue.list' => '\app\listener\chat\ChatQueueList', ], 'subscribe' => [], ], 'rpc' => [ 'server' => [ 'enable' => false, 'port' => 9000, 'services' => [ ], ], 'client' => [ ], ], 'hot_update' => [ 'enable' => env('APP_DEBUG', false), 'name' => ['*.php'], 'include' => [app_path()], 'exclude' => [], ], //连接池 'pool' => [ 'db' => [ 'enable' => true, 'max_active' => 30, 'max_wait_time' => 5, ], 'cache' => [ 'enable' => true, 'max_active' => 30, 'max_wait_time' => 5, ], //自定义连接池 ], 'coroutine' => [ 'enable' => true, 'flags' => SWOOLE_HOOK_ALL, ], 'tables' => [ 'fd' => ['size' => 102400, 'columns' => [ ['name' => 'mode', 'type' => \Swoole\Table::TYPE_STRING, 'size' => 32], ['name' => 'user_id', 'type' => \Swoole\Table::TYPE_INT], ['name' => 'table_id', 'type' => \Swoole\Table::TYPE_INT], ['name' => 'scan_appid', 'type' => \Swoole\Table::TYPE_INT], ['name' => 'api_appid', 'type' => \Swoole\Table::TYPE_INT], ['name' => 'username', 'type' => \Swoole\Table::TYPE_STRING, 'size' => 32], ['name' => 'table_name', 'type' => \Swoole\Table::TYPE_STRING, 'size' => 32], ]], 'space' => ['size' => 102400, 'columns' => [ ['name' => 'fd', 'type' => \Swoole\Table::TYPE_INT], ['name' => 'mode', 'type' => \Swoole\Table::TYPE_STRING, 'size' => 32], ['name' => 'table_name', 'type' => \Swoole\Table::TYPE_STRING, 'size' => 32], ]], 'scan' => ['size' => 102400, 'columns' => [ ['name' => 'fd', 'type' => \Swoole\Table::TYPE_INT], ['name' => 'mode', 'type' => \Swoole\Table::TYPE_STRING, 'size' => 32], ['name' => 'appid', 'type' => \Swoole\Table::TYPE_INT], ]], 'user' => ['size' => 102400, 'columns' => [ ['name' => 'fd', 'type' => \Swoole\Table::TYPE_INT], ['name' => 'mode', 'type' => \Swoole\Table::TYPE_STRING, 'size' => 32], ['name' => 'username', 'type' => \Swoole\Table::TYPE_STRING, 'size' => 32], ['name' => 'isToBet', 'type' => \Swoole\Table::TYPE_INT], ['name' => 'toBetTime', 'type' => \Swoole\Table::TYPE_INT], ['name' => 'isToRob', 'type' => \Swoole\Table::TYPE_INT], ['name' => 'toRobTime', 'type' => \Swoole\Table::TYPE_INT], ['name' => 'isToCancelBet', 'type' => \Swoole\Table::TYPE_INT], ['name' => 'toCancelBetTime', 'type' => \Swoole\Table::TYPE_INT], ['name' => 'isToSeat', 'type' => \Swoole\Table::TYPE_INT], ['name' => 'toSeatTime', 'type' => \Swoole\Table::TYPE_INT], ['name' => 'isToLeaveSeat', 'type' => \Swoole\Table::TYPE_INT], ['name' => 'toLeaveSeatTime', 'type' => \Swoole\Table::TYPE_INT], ]], 'api' => ['size' => 102400, 'columns' => [ ['name' => 'fd', 'type' => \Swoole\Table::TYPE_INT], ['name' => 'mode', 'type' => \Swoole\Table::TYPE_STRING, 'size' => 32], ['name' => 'appid', 'type' => \Swoole\Table::TYPE_INT], ]], 'manager' => ['size' => 102400, 'columns' => [ ['name' => 'fd', 'type' => \Swoole\Table::TYPE_INT], ['name' => 'mode', 'type' => \Swoole\Table::TYPE_STRING, 'size' => 32], ['name' => 'username', 'type' => \Swoole\Table::TYPE_STRING, 'size' => 32], ]], ], //每个worker里需要预加载以共用的实例 'concretes' => [], //重置器 'resetters' => [], //每次请求前需要清空的实例 'instances' => [], //每次请求前需要重新执行的服务 'services' => [], ];