All Blogs | Help
9th September 2010 @ 22:33
Code Tags: PHP
So I may be a bit late to the party, but I have now created by first GitHub project. For my project I decided to actually finish my MQTT class.

I have posted it at http://github.com/bluerhinos/phpMQTT

At the moment the publishing part works a treat, but there currently a problem with the subscribe part (hangs after about 3 hours) I am trying to trace the fault. Also at the moment it will only support quality of service (qos) of 0.

Example Publishing:
php code:
require("../phpMQTT.php");
$mqtt = new phpMQTT();
/* broker(broker address, broker port, client id); */
$mqtt->broker("example.com", 1883, "PHP MQTT Client");
$mqtt->connect();
/* publish( topic, message, qos); */
$mqtt->publish("bluerhinos/phpMQTT/examples/publishtest","Hello World!",0);
$mqtt->close();