Press Ctrl+C to stop. Start success.
BusinessWorker Start
worker[Gateway:26646] exit with status 64000
worker[Gateway:26670] exit with status 64000
worker[Gateway:26699] exit with status 64000
worker[Gateway:26727] exit with status 64000
worker[Gateway:26731] exit with status 64000
worker[Gateway:26765] exit with status 64000
worker[Gateway:26804] exit with status 64000
worker[Gateway:26829] exit with status 64000
worker[Gateway:26843] exit with status 64000
worker[Gateway:26846] exit with status 64000
worker[Gateway:26847] exit with status 64000
worker[Gateway:26850] exit with status 64000
worker[Gateway:26851] exit with status 64000
worker[Gateway:26854] exit with status 64000
worker[Gateway:26867] exit with status 64000
worker[Gateway:26870] exit with status 64000
worker[Gateway:26871] exit with status 64000
worker[Gateway:26874] exit with status 64000
^CWorkerman[artisan] stopping ...
worker[Gateway:26875] exit with status 64000
Workerman[artisan] has been stopped
代码
private function start()
{
$this->startGateWay();
$this->startBusinessWorker();
$this->startRegister();
Worker::runAll();
}
private function startBusinessWorker()
{
$worker = new BusinessWorker();
$worker->name = 'BusinessWorker'; #设置BusinessWorker进程的名称
$worker->count = 1; #设置BusinessWorker进程的数量
$worker->registerAddress = '127.0.0.1:12360'; #注册服务地址
$worker->eventHandler = \App\GatewayWorker\Events::class; #设置使用哪个类来处理业务,业务类至少要实现onMessage静态方法,onConnect和onClose静态方法可以不用实现
}
private function startGateWay()
{
$gateway = new Gateway("websocket://0.0.0.0:22222");
$gateway->name = 'Gateway'; #设置Gateway进程的名称,方便status命令中查看统计
$gateway->count = 1; #进程的数量
$gateway->lanIp = '127.0.0.1'; #内网ip,多服务器分布式部署的时候需要填写真实的内网ip
$gateway->startPort = 2300; #监听本机端口的起始端口
$gateway->pingInterval = 30;
$gateway->pingNotResponseLimit = 0; #服务端主动发送心跳
$gateway->pingData = '{"mode":"heart"}';
$gateway->registerAddress = '127.0.0.1:12360'; #注册服务地址
}
private function startRegister()
{
new Register('text://0.0.0.0:12360');
}
Workerman version:4.0.39 PHP version:7.4.11 gateway-worker 3.0.22
换个服务器就好了