webman里安装好了gatewayworker,只有一个websock的端口监听,想再加一个websock的新的端口监听别的业务,怎么做?
<?php
use Webman\GatewayWorker\Gateway;
use Webman\GatewayWorker\BusinessWorker;
use Webman\GatewayWorker\Register;
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,
'pingNotResponseLimit' => 1,//客户端是否必须发送心跳给服务端,1发送,0不发送
'pingInterval' => 55,
// 'pingData' => '{"msg_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://127.0.0.1:1236',
'count' => 1, // Must be 1
'constructor' => []
],
];
7272和7373处理的业务如果要写在不同的Events.php文件中,要如何配置呀~
那就是属于部署两套分离的gatewayWorker,二者不互通。看gatewayWorker手册常见问题
哦哦
思路就是,按照在其他框架中使用GatewayWorker对吧
部署多实例