Commit bc87b27e by Chavee Issariyapat

fix typo, remove log

parent 73a790d8
...@@ -104,9 +104,9 @@ const Coordinator = function(param={}) { ...@@ -104,9 +104,9 @@ const Coordinator = function(param={}) {
let devicetoken = client.devicetoken; let devicetoken = client.devicetoken;
if (topic.startsWith('@local/msgin/')) { if (topic.startsWith('@local/msgin/')) {
let msgpart = topic.split('/').splice(4).join('/'); let msgpart = topic.split('/').splice(4).join('/');
let touttopic = `@tap/msg/topic/${deviceid}:${devicetoken}/${msgpart}`; let outtopic = `@tap/msg/topic/${deviceid}:${devicetoken}/${msgpart}`;
if (that.topicstore.addTopic(outtopic, client.nodeid)) { if (that.topicstore.addTopic(outtopic, client.nodeid)) {
console.log('----- subscribe : '+outtopic) if (DEBUG) console.log('----- subscribe : '+outtopic)
that.mqttclient.subscribe(outtopic); that.mqttclient.subscribe(outtopic);
} }
} }
...@@ -123,7 +123,7 @@ const Coordinator = function(param={}) { ...@@ -123,7 +123,7 @@ const Coordinator = function(param={}) {
let msgpart = topic.split('/').splice(4).join('/'); let msgpart = topic.split('/').splice(4).join('/');
outtopic = `@tap/msg/topic/${deviceid}:${devicetoken}/${msgpart}`; outtopic = `@tap/msg/topic/${deviceid}:${devicetoken}/${msgpart}`;
if (that.topicstore.delTopic(outtopic, client.nodeid)) { if (that.topicstore.delTopic(outtopic, client.nodeid)) {
console.log('----- unsubscribe : '+outtopic) if (DEBUG) console.log('----- unsubscribe : '+outtopic)
that.mqttclient.unsubscribe(outtopic); that.mqttclient.unsubscribe(outtopic);
} }
} }
...@@ -134,7 +134,7 @@ const Coordinator = function(param={}) { ...@@ -134,7 +134,7 @@ const Coordinator = function(param={}) {
this.flowemitter.on('startcountdownreset', function() { this.flowemitter.on('startcountdownreset', function() {
if (!resettimer) { if (!resettimer) {
resettimer = setTimeout(function() { resettimer = setTimeout(function() {
console.log(' [info] MQTT resetting...'); if (DEBUG) console.log(' [info] MQTT resetting...');
that.mqttclient.resetbroker(); that.mqttclient.resetbroker();
}, RESETDELAY); }, RESETDELAY);
} }
...@@ -146,7 +146,7 @@ const Coordinator = function(param={}) { ...@@ -146,7 +146,7 @@ const Coordinator = function(param={}) {
this.mqttclient.on('close', function() { this.mqttclient.on('close', function() {
this.started = false; this.started = false;
console.log(' [info] Disconnect from MQTT broker.') if (DEBUG) console.log(' [info] Disconnect from MQTT broker.')
}); });
this.mqttclient.on('message', function(topic, payload){ this.mqttclient.on('message', function(topic, payload){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment