关于mqtt的publish的问题,文档说publish方法是有回调的,我想用回调来监控是否有推送异常的情况,但是我写上回调,就会报错,我是不是哪里写的不对?
$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"
改成
感谢大佬,已改