mgdm / Mosquitto-PHP

A wrapper for the Eclipse Mosquitto™ MQTT client library for PHP.
BSD 3-Clause "New" or "Revised" License
528 stars 146 forks source link

Not connecting to Mosquitto server #102

Closed sujitkv92 closed 5 years ago

sujitkv92 commented 5 years ago

I have installed mosquitto broker on a centos server. for communication I installed Mosquitto-PHP library. publisher and subscriber are working fine on the same server but when I am trying to publish message from this centos server and running subscriber code from local machine ubuntu then getting following error -

PHP Fatal error: Uncaught Mosquitto\Exception: The client is not currently connected. in /home/sujit/Desktop/php_test.php:12 Stack trace:

0 /home/sujit/Desktop/php_test.php(12): Mosquitto\Client->subscribe('#', 1)

1 {main}

thrown in /home/sujit/Desktop/php_test.php on line 12

Mosquitto-PHP library installed on local server.

sujitkv92 commented 5 years ago

It is fixed now. there was port issue. enabled 1883/tcp port and its working fine now.