大佬帮看看mqtt的实例报错吧

864328615

问题描述

还没有链接 就报错了

程序代码

 public function onWorkerStart()
    {
        var_dump(getenv('MQTT_HOST') . ':' . getenv('MQTT_PORT'));
        var_dump(getenv('MQTT_USER') . ':' . getenv('MQTT_PASSWORD'));
        $mqtt = new Client(getenv('MQTT_HOST') . ':' . getenv('MQTT_PORT'), [
            'username' => getenv('MQTT_USER'),
            'password' => getenv('MQTT_PASSWORD'),
        ]);
    }

报错信息

Fatal error: Declaration of Workerman\Mqtt\Protocols\Mqtt::input(string $buffer, Workerman\Connection\ConnectionInterface $connection): int must be compatible with Workerman\Protocols\ProtocolInterface::input($recv_buffer, Workerman\Connection\ConnectionInterface $connection) in /Users/zhengjiefeng/yujianshanhai/api-device-dept/vendor/workerman/mqtt/src/Protocols/Mqtt.php on line 134

操作系统及workerman/webman等框架组件具体版本

macos
php8.3

140 1 0
1个回答

提问时把workerman 和 mqtt版本发下。
composer info 能看到版本信息

  • 暂无评论
×
🔝