把 config/plugin/gatewaw-worker 复制一份方同级目录 改改端口配置及 Events位置即可
要配置多个协议吗?还是要用一个event.php这个文件
看我下方截图, 改的地方圈住了
看下图 ,我是这样处理的
return [ 'gateway' => [ 'handler' => Gateway::class, 'listen' => 'websocket://0.0.0.0:7272', 'count' => cpu_count(), 'reloadable' => false, 'constructor' => ['config' => [ 'lanIp' => '127.0.0.1', 'startPort' => 2300, 'pingInterval' => 25, 'pingData' => '{"type":"ping"}', 'registerAddress' => '127.0.0.1:1236', 'onConnect' => function(){}, ]] ], 'worker' => [ 'handler' => BusinessWorker::class, 'count' => cpu_count()*2, 'constructor' => ['config' => [ 'eventHandler' => plugin\webman\gateway\Events::class, 'name' => 'ChatBusinessWorker', 'registerAddress' => '127.0.0.1:1236', ]] ], 'register' => [ 'handler' => Register::class, 'listen' => 'text://0.0.0.0:1236', 'count' => 1, // Must be 1 'constructor' => [] ], 'gatewayTCP' => [ 'handler' => Gateway::class, 'listen' => 'tcp://0.0.0.0:7070', 'count' => cpu_count(), 'reloadable' => false, 'constructor' => ['config' => [ 'lanIp' => '127.0.0.1', 'startPort' => 4100, 'pingInterval' => 25, 'pingData' => '{"type":"ping"}', 'registerAddress' => '127.0.0.1:1236', 'onConnect' => function(){}, ]] ], ];
你这样也可以, 共用一个Events.php 如果业务逻辑没啥交集的话, 单独处理我感觉比较好
要配置多个协议吗?还是要用一个event.php这个文件
看我下方截图, 改的地方圈住了
看下图 ,我是这样处理的
你这样也可以, 共用一个Events.php 如果业务逻辑没啥交集的话, 单独处理我感觉比较好