Skip to content

Commit

Permalink
Merge pull request Koenkk#214 from Koenkk/issue_148
Browse files Browse the repository at this point in the history
Add support for MQTT client ID. Koenkk#148
  • Loading branch information
Koenkk authored Jul 24, 2018
2 parents 8903910 + 7485b22 commit 9266a7a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/mqtt.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ class MQTT {
options.password = mqttSettings.password;
}

if (mqttSettings.client_id) {
logger.debug(`Using MQTT client ID: '${mqttSettings.client_id}'`);
options.clientId = mqttSettings.client_id;
}

this.client = mqtt.connect(mqttSettings.server, options);

// Register callbacks.
Expand Down

0 comments on commit 9266a7a

Please sign in to comment.