<?xml version="1.0" encoding="UTF-8"?>
<posts to="2010-09-09T22:33:10+01:00" from="2010-09-09T22:33:10+01:00"><post><id>56</id><rid>57</rid><title>My First GitHub Project: phpMQTT</title><section>Code Tutorial</section><author><username>thebluerhino.myopenid.com</username><name>Andrew Milsted</name></author><content><![CDATA[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:
[code=php]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();[/code]]]></content><html><![CDATA[<b>Code Tags:</b> PHP<br />
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.<br style="clear:left;"/><br style="clear:left;"/>I have posted it at <a href="http://github.com/bluerhinos/phpMQTT">http://github.com/bluerhinos/phpMQTT</a><br style="clear:left;"/><br style="clear:left;"/>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. <br style="clear:left;"/> <br style="clear:left;"/>Example Publishing:<br style="clear:left;"/><pre class="php" style="color: #000066; border: 1px solid #d0d0d0; background-color: #f0f0f0; padding:5px;"><div style="font-family: Verdana, Arial, sans-serif; color: #808080; font-size: 70%; font-weight: bold; border-bottom: 1px solid #d0d0d0; padding: 0px;">php code:</div><span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;../phpMQTT.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br style="clear:left;"/><span style="color: #000033;">$mqtt</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> phpMQTT<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br style="clear:left;"/><span style="color: #666666; font-style: italic;">/* broker(broker address, broker port, client id); */</span><br style="clear:left;"/><span style="color: #000033;">$mqtt</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">broker</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;example.com&quot;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1883</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;PHP MQTT Client&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br style="clear:left;"/><span style="color: #000033;">$mqtt</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br style="clear:left;"/><span style="color: #666666; font-style: italic;">/* publish( topic, message, qos); */</span><br style="clear:left;"/><span style="color: #000033;">$mqtt</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">publish</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;bluerhinos/phpMQTT/examples/publishtest&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;Hello World!&quot;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br style="clear:left;"/><span style="color: #000033;">$mqtt</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre><div class="postTools"></div>

]]></html><datestamp>2010-09-09T22:33:10+01:00</datestamp><timestamp>2010-09-09T22:36:32+01:00</timestamp><blog>8</blog><key>581771d68fbcdf08e7c708b0d5be7944</key><metadata><code_tags>PHP</code_tags></metadata><links><uri>http://blogs.bluerhinos.co.uk/uri/11</uri><permalink>http://blogs.bluerhinos.co.uk/thinkblue/56/My_First_GitHub_Project_phpMQTT.html</permalink></links><formats><format type="text/html">http://blogs.bluerhinos.co.uk/thinkblue/56/My_First_GitHub_Project_phpMQTT.html</format><format type="text/xml">http://blogs.bluerhinos.co.uk/thinkblue/56/My_First_GitHub_Project_phpMQTT.xml</format><format type="image/png">http://blogs.bluerhinos.co.uk/thinkblue/56/My_First_GitHub_Project_phpMQTT.png</format></formats><revisions><revision>http://blogs.bluerhinos.co.uk/thinkblue/56/My_First_GitHub_Project_phpMQTT.xml?revision=56</revision><revision current="true">http://blogs.bluerhinos.co.uk/thinkblue/56/My_First_GitHub_Project_phpMQTT.xml?revision=57</revision></revisions><comments/></post></posts>

