Commit 74489dc2 by Chavee Issariyapat

reset flowchannel when channel endpoint is updated

parent f6b95010
...@@ -208,8 +208,21 @@ Coordinator.prototype.start = function() { ...@@ -208,8 +208,21 @@ Coordinator.prototype.start = function() {
return true; return true;
} }
else { else {
return true;
}
}
Coordinator.prototype.stop = function() {
if (this.started) {
this.started = false;
this.mqttclient.disconnect();
return false; return false;
} }
else {
return false;
}
} }
function create(param) { function create(param) {
......
...@@ -65,6 +65,11 @@ FlowAgent.prototype.start = function() { ...@@ -65,6 +65,11 @@ FlowAgent.prototype.start = function() {
else return false; else return false;
} }
FlowAgent.prototype.stop = function() {
this.started = this.coordinator.stop();
}
FlowAgent.prototype.getInfo = function() { FlowAgent.prototype.getInfo = function() {
return { return {
broker_uri : this.option.broker_uri, broker_uri : this.option.broker_uri,
......
...@@ -22,7 +22,7 @@ function sleep(ms) { ...@@ -22,7 +22,7 @@ function sleep(ms) {
MQTTClient.prototype.__proto__ = EventEmitter.prototype; MQTTClient.prototype.__proto__ = EventEmitter.prototype;
MQTTClient.prototype.connect = function() { MQTTClient.prototype.connect = function() {
var that = this; let that = this;
if (this.client) delete this.client; if (this.client) delete this.client;
...@@ -49,7 +49,10 @@ MQTTClient.prototype.connect = function() { ...@@ -49,7 +49,10 @@ MQTTClient.prototype.connect = function() {
console.log('MQClient Error:'); console.log('MQClient Error:');
console.log(error); console.log(error);
}); });
}
MQTTClient.prototype.disconnect = function() {
this.client.end();
} }
MQTTClient.prototype.resetbroker = function(topic, payload) { MQTTClient.prototype.resetbroker = function(topic, payload) {
......
{ {
"name": "flowagent", "name": "flowagent",
"version": "1.2.1", "version": "1.2.2",
"description": "", "description": "",
"main": "flowagent.js", "main": "flowagent.js",
"scripts": { "scripts": {
......
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