Skip to content

Instantly share code, notes, and snippets.

@mgdm
Last active January 28, 2016 21:33
Show Gist options
  • Save mgdm/1223e4bbfab5b15a4faf to your computer and use it in GitHub Desktop.
Save mgdm/1223e4bbfab5b15a4faf to your computer and use it in GitHub Desktop.
1454016307: Sending CONNACK to mosq/QNQA<M\fj0`IEBIKjk (0, 0)
1454016307: Received PUBLISH from mosq/QNQA<M\fj0`IEBIKjk (d0, q2, r0, m1, 'test/mgdm', ... (5 bytes))
1454016307: Sending PUBREC to mosq/QNQA<M\fj0`IEBIKjk (Mid: 1)
1454016307: Received PUBREL from mosq/QNQA<M\fj0`IEBIKjk (Mid: 1)
1454016307: Sending PUBCOMP to mosq/QNQA<M\fj0`IEBIKjk (Mid: 1)
array(2) {
[0] =>
int(16)
[1] =>
string(46) "Client mosq/av@98ACdjxDxNN5c>K sending CONNECT"
}
array(2) {
[0] =>
int(16)
[1] =>
string(47) "Client mosq/av@98ACdjxDxNN5c>K received CONNACK"
}
array(2) {
[0] =>
int(16)
[1] =>
string(91) "Client mosq/av@98ACdjxDxNN5c>K sending PUBLISH (d0, q2, r0, m1, 'test/mgdm', ... (5 bytes))"
}
array(2) {
[0] =>
int(16)
[1] =>
string(55) "Client mosq/av@98ACdjxDxNN5c>K received PUBREC (Mid: 1)"
}
array(2) {
[0] =>
int(16)
[1] =>
string(54) "Client mosq/av@98ACdjxDxNN5c>K sending PUBREL (Mid: 1)"
}
array(2) {
[0] =>
int(16)
[1] =>
string(56) "Client mosq/av@98ACdjxDxNN5c>K received PUBCOMP (Mid: 1)"
}
<?php
$c = new Mosquitto\Client;
$c->onLog(function(...$args) {
var_dump($args);
});
$c->onConnect(function() use ($c) {
$c->publish('test/mgdm', 'Hello', 2);
});
$c->connect('test.mosquitto.org');
$c->loopForever();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment