workerman/mqtt 的保留消息接收

lgmmy

subscribe中onMessage接收到的消息如何判断是否retained保留消息?

<?php
use Workerman\Worker;
require_once __DIR__ . '/vendor/autoload.php';

$worker = new Worker();
$worker->onWorkerStart = function(){
    $mqtt = new Workerman\Mqtt\Client('mqtt://test.mosquitto.org:1883');
    $mqtt->onConnect = function($mqtt) {
        $mqtt->subscribe('test');
    };
    $mqtt->onMessage = function($topic, $content){
        //如何判断是retained保留消息?
        var_dump($topic, $content);
    };
    $mqtt->connect();
};
Worker::runAll();
225 0 0
0个回答

×
🔝