You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Subscribe to a channel and register a callback for it
38
-
sc.subscribe("myChannel", newMessageListener() {
39
-
@Override
40
-
publicvoidprocessMessage(Stringmessage) {
41
-
System.out.println(message);
42
-
}
43
-
});
37
+
// Subscribe to a channel and register a callback for it
38
+
sc.subscribe("myChannel", newMessageListener() {
39
+
@Override
40
+
publicvoidprocessMessage(Stringmessage) {
41
+
System.out.println(message);
42
+
}
43
+
});
44
44
45
-
// Do something...
45
+
// Publish to a channel
46
+
sc.publish("myOtherChannel", "A message from me");
46
47
47
-
// Publish to a channel
48
-
sc.publish("myOtherChannel", "A message from me");
49
-
50
-
// Do something else...
51
-
52
-
// Unsubscribe from a channel
53
-
sc.unsubscribe("myChannel");
48
+
// Unsubscribe from a channel
49
+
sc.unsubscribe("myChannel");
54
50
55
51
// Disconnect from broker
56
52
sc.disconnect();
53
+
54
+
// Do something else or the client will die...
55
+
// while (!Thread.currentThread().isInterrupted()) {
56
+
// }
57
57
}
58
58
}
59
59
@@ -62,5 +62,5 @@ public class MQTTClientDemo {
62
62
For a complete example see `MQTTClientDemo.java` in `ltg.commons.examples`.
63
63
64
64
# Important note
65
-
This library is based off of a fixed version of the [Eclipse Paho java library](http://www.eclipse.org/paho/clients/java/). Hopefully they will fix their broken Maven repo and release system one day.
65
+
This library is based off of the [fusesource mqtt library](https://github.com/fusesource/mqtt-client).
0 commit comments