Skip to content

Commit 106f54e

Browse files
authored
Merge pull request #15 from FlowFuse/fix-ssl
Fix ssl
2 parents 9bac8c4 + ae545d0 commit 106f54e

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

lib/agent.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ class Agent {
2929
}
3030
}).json()
3131

32+
// console.log(`creds: ${JSON.stringify(this.creds,null, 2)}`)
3233
this.creds = Object.assign(this.creds, { reconnectPeriod: 0 })
33-
// console.log(this.creds)
3434

3535
if (this.creds.ssl) {
3636
switch (this.creds.protocol) {
@@ -44,9 +44,6 @@ class Agent {
4444
}
4545

4646
const options = {
47-
protocol: this.creds.protocol,
48-
host: this.creds.host,
49-
port: this.creds.port,
5047
clientId: this.creds.clientId,
5148
protocolVersion: this.creds.protocolVersion,
5249
username: this.creds.credentials.username,
@@ -57,13 +54,15 @@ class Agent {
5754
options.rejectUnauthorized = false
5855
}
5956

57+
const url = `${this.creds.protocol}//${this.creds.host}:${this.creds.port}`
58+
// console.log(url)
6059
// console.log(options)
6160

6261
// this.client = mqtt.connect(`${this.creds.protocol}//${this.creds.hostname}:${this.creds.port}`, this.creds)
63-
this.client = mqtt.connect(options)
62+
this.client = mqtt.connect(url, options)
6463
this.client.on('connect', function () {
6564
agent.connected = true
66-
console.log(`connected to ${options.host}:${options.port} as ${options.clientId}`)
65+
console.log(`connected to ${agent.creds.host}:${agent.creds.port} as ${options.clientId}`)
6766
agent.error = null
6867
agent.client.subscribe('#')
6968
})

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@flowfuse/mqtt-schema-agent",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"description": "Agent to collect MQTT topic Schema",
55
"main": "index.js",
66
"homepage": "https://flowfuse.com",

0 commit comments

Comments
 (0)