Commit 1124bbbe by Chavee Issariyapat

update

parent 479776e2
module.exports.create = create
const Mosca = require('mosca');
const events = require('events');
const MQTTServer = function(param = {}) {
this.param = param;
}
MQTTServer.prototype = new events.EventEmitter;
MQTTServer.prototype.start = function() {
let that = this;
this.mqttserver = new Mosca.Server({
port : this.param.port,
host : this.param.host
});
this.mqttserver.on('ready', function() {
console.log(`FlowAgent MQTT is up and running at ${that.param.port}`);
});
this.mqttserver.on('clientConnected', function(client) {
console.log('client connected', client.id);
});
}
// MQTTServer.prototype.xxx = function(topic, payload) {
// }
function create(param) {
return new MQTTServer(param);
}
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
"dependencies": { "dependencies": {
"config": "^3.2.4", "config": "^3.2.4",
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
"mosca": "^2.8.3",
"mqtt": "^3.0.0" "mqtt": "^3.0.0"
} }
} }
\ No newline at end of file
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