Skip to content
Snippets Groups Projects
Commit c124a4f4 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Set QOS level to 1 (2 doesn't work?)

Remove unnecessary call to JSON.stringify() in non-JSON mode
parent e8ff1935
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@
var mqtt = new MQTT;
var topic = "sbbs/" + system.qwk_id + "/stats";
var retain = true;
var qos = 1;
if(!mqtt.connect()) {
alert(format("Error (%s) connecting to %s:%u"
......@@ -13,13 +14,13 @@ if(!mqtt.connect()) {
}
if(argv.indexOf("-json") >= 0) {
if(!mqtt.publish(retain, topic, JSON.stringify(system.stats))) {
if(!mqtt.publish(retain, qos, topic, JSON.stringify(system.stats))) {
alert(format("Error (%s) publishing to %s", mqtt.error_str, topic));
exit(1);
}
} else {
for(var p in system.stats) {
if(!mqtt.publish(retain, topic + "/" + p, JSON.stringify(system.stats[p]))) {
if(!mqtt.publish(retain, qos, topic + "/" + p, system.stats[p])) {
alert(format("Error (%s) publishing to %s", mqtt.error_str, topic));
exit(1);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment