You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fatal error: Uncaught Mosquitto\Exception: Invalid function arguments provided. : Mosquitto\Client->loop(100) .
A mistake similar to yours!!!!
help,help,help.
call this function client->loopForever() , Often appear Invalid function arguments provided
below is the code I wrote:
public function send($msg){
try {
$mid = 0;
$mqttclient = new \Mosquitto\Client;
$gateway_topic = $this->topic;
$mqttclient->onConnect(function() use ($mqttclient, $gateway_topic,&$mid,$msg)
{
$mid = $mqttclient->publish($gateway_topic,$msg,$this->qos,1);
$mqttclient->disconnect();
});
$mqttclient->setCredentials($this->username, $this->password);
$mqttclient->connect($this->server, $this->port, 5);
$mqttclient->loopforever();
} catch (Exception $e) {
writeException($e);
}
echo "success";
}
please help, thank you!
The text was updated successfully, but these errors were encountered: