国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

webman gateway-worker自定義Gateway

sanergo
//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
請問應該怎么寫才對??

954 1 0
1個回答

Tinywan

你這命名空間不正確吧

  • sanergo 2024-04-09

    路徑是沒問題的 是在app/plugin/gateway-worker目錄 在vscode都可以直接跳轉(zhuǎn)到類。

  • Tinywan 2024-04-10

    重啟下試試

  • six 2024-04-10

    目錄名不對,按照你的命名空間應該是 app/plugin/GatewayWorker 目錄,大小寫都要對應上才行

  • sanergo 2024-04-10

    確實是這樣的,主要是復制的webman的gateway-worker,用的也是"-",直接轉(zhuǎn)大寫就行了,大概看了下,應該是autoloader有轉(zhuǎn)換。

年代過于久遠,無法發(fā)表回答
??