From b2592bf468206246484d10b808ace421082e9cda Mon Sep 17 00:00:00 2001 From: Michael Kuehl Date: Thu, 14 Sep 2017 16:40:35 -0400 Subject: [PATCH] allow the endpoint to be configured by options --- lib/mqtt.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/mqtt.js b/lib/mqtt.js index 5e3a118..3fecbae 100644 --- a/lib/mqtt.js +++ b/lib/mqtt.js @@ -52,7 +52,7 @@ MQTT.prototype.connect = function(options, callback) { var prefixPort = transportPrefixes[options.transport] || transportPrefixes.tls; - var url = prefixPort.prefix + config.mqttEndpoint; + var url = prefixPort.prefix + (options.mqttEndpoint || config.mqttEndpoint); callback = callback || function() {}; @@ -63,7 +63,7 @@ MQTT.prototype.connect = function(options, callback) { url, { clientId: options.id, username: options.key, password: options.secret, - port: prefixPort.port }); + port: options.port || prefixPort.port }); this.client.on('connect', (function() { debug('MQTT successfully connected to ' + url);