Open nishitmodi2591 opened 5 years ago
The code works fine when the BLE gateway is on. Whenever the BLE gateway is off it stops working and doesn't even give connection error.
Here is my code:
try { $mqttclient = new \Mosquitto\Client; $mqttclient->onConnect(function() use ($mqttclient, $gateway_topic) { $mqttclient->subscribe($gateway_topic, 0); }); $mqttclient->onMessage(function($message) use($mqttclient) { $this->DataParse($message); }); if(!empty($username) && !empty($password)) { $mqttclient->setCredentials($username, $password); } $mqttclient->connect($mqtt_server_host, $mqtt_server_port, 60); $mqttclient->loopforever(); } catch (Exception $e) { writeException($e); }
Please suggest how it can be resolved.
The code works fine when the BLE gateway is on. Whenever the BLE gateway is off it stops working and doesn't even give connection error.
Here is my code:
Please suggest how it can be resolved.