Open bahamas10 opened 3 years ago
I've dug deeper into this issue. This appears to be due to my TLS proxy requiring SNI support, which was added to MQTT.js
in this commit: f6534c2d8348afadc91c4d6c636447430be4642b
I manually got this to work with this one-line change:
diff --git a/lib/connect/tls.js b/lib/connect/tls.js
index eda78be..419cedd 100644
--- a/lib/connect/tls.js
+++ b/lib/connect/tls.js
@@ -5,6 +5,7 @@ function buildBuilder (mqttClient, opts) {
var connection
opts.port = opts.port || 8883
opts.host = opts.hostname || opts.host || 'localhost'
+ opts.servername = opts.host
opts.rejectUnauthorized = opts.rejectUnauthorized !== false
In /opt/local/lib/node_modules/homebridge-mqttthing/node_modules/mqtt/lib/connect/tls.js
Though this fixes my issue manually, I will leave this open as upgrading the mqtt dep may still be beneficial.
hello! I'm very interested in getting this plugin setup with my
zwavejs2mqtt
setup. I tried setting this up but noticed, while it looked like everything was working, mqttthing wouldn't connect to my mqtt broker at all (mosquitto v2.0.10 running behind a TLS proxy).I did some debugging - i pulled in the same version of
mqtt
that this plugin used and attempted to manually invoke thesub.js
file that accompanies that repo:Install:
Test:
I then manually published some messages to that topic and saw that none of them were seen by
./sub.js
. In fact, I could see from my proxy logs and the mosquitto logs that no connection was ever made. No error was ever seen, the./sub.js
command just seemed to hand indefinitely.I then pulled the next major release -
v3.0.0
.Then test again:
Same issue - no messages were ever seen.
Finally, i decided to pull the latest master code:
And then test again. Note that the usage of
./sub.js
has changed with this version. The protocol is now specified as-l
and is omitted from the-h
argument:The latest version (
v4.x.x
) seems to be the only one that works for me. I'm not sure exactly why this is.Note that I tested this TWICE: once with node
v14.16.1
and again with nodev12.21.0
- both yielding the same results.So my question is - is upgrading to a later version of mqtt possible for this plugin? I'll take a look into doing this myself manually to test, but I figured it would be best to write down and document everything I have seen while doing this.