1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Add use strict to mqtt node, allow will parm to be passed.

This commit is contained in:
Dave C-J 2014-05-29 09:00:28 +01:00
parent 1d5e8de6f6
commit 7ad28de52a
2 changed files with 20 additions and 21 deletions

View File

@ -15,7 +15,7 @@
**/ **/
module.exports = function(RED) { module.exports = function(RED) {
"use strict";
var connectionPool = require("./lib/mqttConnectionPool"); var connectionPool = require("./lib/mqttConnectionPool");
var util = require("util"); var util = require("util");
@ -151,4 +151,3 @@ module.exports = function(RED) {
} }
} }
} }

View File

@ -28,7 +28,7 @@ function matchTopic(ts,t) {
} }
module.exports = { module.exports = {
get: function(broker,port,clientid,username,password) { get: function(broker,port,clientid,username,password,will) {
var id = "["+(username||"")+":"+(password||"")+"]["+(clientid||"")+"]@"+broker+":"+port; var id = "["+(username||"")+":"+(password||"")+"]["+(clientid||"")+"]@"+broker+":"+port;
if (!connections[id]) { if (!connections[id]) {
connections[id] = function() { connections[id] = function() {
@ -40,6 +40,7 @@ module.exports = {
options.clientId = clientid || 'mqtt_' + (1+Math.random()*4294967295).toString(16); options.clientId = clientid || 'mqtt_' + (1+Math.random()*4294967295).toString(16);
options.username = username; options.username = username;
options.password = password; options.password = password;
options.will = will;
var queue = []; var queue = [];
var subscriptions = []; var subscriptions = [];
var connecting = false; var connecting = false;
@ -125,4 +126,3 @@ module.exports = {
return connections[id]; return connections[id];
} }
}; };