//process的配置文件
<?php
use Webman\GatewayWorker\Gateway;
use app\plugin\GatewayWorker\Gateway as GatewayPlugin;
use Webman\GatewayWorker\BusinessWorker;
use Webman\GatewayWorker\Register;
return [
'gateway-websocket' => [
'handler' => GatewayPlugin::class,
'listen' => 'websocket://0.0.0.0:7272',
'count' => cpu_count(),
'reloadable' => false,
'constructor' => ['config' => [
'lanIp' => '127.0.0.1',
'startPort' => 2300,
'pingInterval' => 10,
'pingNotResponseLimit' => 1,
'pingData' => '',
'registerAddress' => '127.0.0.1:1236',
'onConnect' => function(){},
]]
],
...省略
];
// 復制webman的Gateway
<?php
namespace app\plugin\GatewayWorker;
class Gateway extends \GatewayWorker\Gateway
{
/**
* @var string
*/
protected $_autoloadRootPath = '';
public function __construct($config)
{
foreach ($config as $key => $value)
{
$this->$key = $value;
}
//$this->router = array("\\app\\plugin\\GatewayWorker\\Gateway", 'routerBindNew');
$this->router = array("\\GatewayWorker\\Gateway", 'routerBind');
}
}
原計劃是自定義一個Gateway用來自定義路由"routerBind "
提示process error: class app\plugin\GatewayWorker\Gateway not exists
請問應該怎么寫才對??
你這命名空間不正確吧