我把webman/gateway-worker插件和配置复制了一份,修改了配置,启动报错!
<?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,
'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://127.0.0.1:1236',
'count' => 1, // Must be 1
'constructor' => []
],
];
<?php
use Webman\GatewayWorker\Gateway;
use Webman\GatewayWorker\BusinessWorker;
use Webman\GatewayWorker\Register;
return [
'gateway' => [
'handler' => Gateway::class,
'listen' => 'websocket://0.0.0.0:7373',
'count' => cpu_count(),
'reloadable' => false,
'constructor' => ['config' => [
'lanIp' => '127.0.0.1',
'startPort' => 2300,
'pingInterval' => 25,
'pingData' => '{"type":"ping"}',
'registerAddress' => '127.0.0.1:1237',
'onConnect' => function(){},
]]
],
'worker' => [
'handler' => BusinessWorker::class,
'count' => cpu_count()*2,
'constructor' => ['config' => [
'eventHandler' => plugin\webman\gateway2\Events::class,
'name' => 'ChatBusinessWorker2',
'registerAddress' => '127.0.0.1:1237',
]]
],
'register' => [
'handler' => Register::class,
'listen' => 'text://127.0.0.1:1237',
'count' => 1, // Must be 1
'constructor' => []
],
];
---------------------------------------------- WORKERMAN -----------------------------------------------
----------------------------------------------- WORKERS ------------------------------------------------
worker listen processes status
webman http://0.0.0.0:8787 1 [ok]
monitor none 1 [ok]
plugin.webman.gateway-worker.gateway websocket://0.0.0.0:7272 1 [ok]
plugin.webman.gateway-worker.worker none 1 [ok]
plugin.webman.gateway-worker.register text://127.0.0.1:1236 1 [ok]
plugin.webman.gateway-worker2.gateway websocket://0.0.0.0:7373 1 [ok]
plugin.webman.gateway-worker2.worker none 1 [ok]
plugin.webman.gateway-worker2.register text://127.0.0.1:1237 1 [ok]
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0
SendBufferToWorker fail. The connections between Gateway and BusinessWorker are not ready. See http://doc2.workerman.net/send-buffer-to-worker-fail.html
SendBufferToWorker fail. The connections between Gateway and BusinessWorker are not ready. See http://doc2.workerman.net/send-buffer-to-worker-fail.html
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0
Gateway: Worker->name conflict. Key:127.0.0.1:ChatBusinessWorker:0
代码截图:
报错截图:
win10
修改startPort端口和重启电脑