up. 添加gateway event类

This commit is contained in:
u2nyakim 2025-08-29 17:57:00 +08:00
parent 73ae0cf33e
commit 87dc171497

View File

@ -49,7 +49,7 @@ class SysGateway extends Command
* 业务处理器
*/
$worker = new BusinessWorker();
$worker->name = 'ChatBusinessWorker';
$worker->name = 'AdminBusinessWorker';
$worker->count = 4;
$worker->registerAddress = '127.0.0.1:1236';
$worker->eventHandler = AdminGatewayEvents::class;
@ -65,22 +65,22 @@ class SysGateway extends Command
}
private function startGateway(): \GatewayWorker\Gateway
{
// gateway 进程
$gateway = new \GatewayWorker\Gateway("Websocket://0.0.0.0:7272");
// 设置名称方便status时查看
$gateway->name = 'ChatGateway';
// 设置进程数,一般两个进程就足够
// gateway 进程
$gateway = new \GatewayWorker\Gateway("Websocket://0.0.0.0:19981");
// 设置名称方便status时查看
$gateway->name = 'AdminGateway';
// 设置进程数,一般两个进程就足够
$gateway->count = 2;
// 分布式部署时请设置成内网ip非127.0.0.1
// 分布式部署时请设置成内网ip非127.0.0.1
$gateway->lanIp = '127.0.0.1';
// 内部通讯起始端口。假如$gateway->count=2起始端口为2300
// 则一般会使用2300 2301 2个端口作为内部通讯端口
// 内部通讯起始端口。假如$gateway->count=2起始端口为2300
// 则一般会使用2300 2301 2个端口作为内部通讯端口
$gateway->startPort = 2300;
// 心跳间隔
// 心跳间隔
$gateway->pingInterval = 10;
// 心跳数据
// 心跳数据
$gateway->pingData = '{"type":"ping"}';
// 服务注册地址
// 服务注册地址
$gateway->registerAddress = '127.0.0.1:1236';
/*