關(guān)于mqtt的publish的問題,文檔說publish方法是有回調(diào)的,我想用回調(diào)來監(jiān)控是否有推送異常的情況,但是我寫上回調(diào),就會報錯,我是不是哪里寫的不對?
$mqtt->publish(
$topic,
json_encode($res['data']),
['qos' => 1],
function(\Exception $e){
var_dump($e->getMessage());
}
);
TypeError: Argument 1 passed to {closure}() must be an instance of Exception, nu
ll given in D:\workspace\newcloud_report\Listens\Udp\Udp1.php:68
"workerman/workerman": "^4.0",
"workerman/mqtt": "^1.2",
"predis/predis": "^2.0",
"guanguans/notify": "^1.24",
"workerman/mysql": "^1.0"