Node.js - Node-RED v3.0.2 MQTT Configuration Windows Quirk

It’s probably related to this change in nodejs behaviour from v17 onwards

Mosquitto Broker. That version has not been updated either. At this time I would need to get the version number.

Why does the MQTT node need different syntax for the address and does not allow "localhost" ? That's the "op's" "oq".

Steve, Sorry for not answering your question about Mosquitto. I guess I just did not see it.
op = Original Post
oq = Original Question

What I was trying to say is that while localhost is certainly accepted as valid by the node, there are several factors as to why "localhost" the concept may have several different actual values depending on use, host file, DNS, DHCP and such settings. Doesn't really help you get an answer but helps understand the context.

Indeed, I think I left 0.0.0.0 off the list as well which may also be valid (representing all of the possible IPv4 addresses across all local interfaces).

If you wanted to, you could probably adjust C:\Windows\System32\drivers\etc\hosts to deal with the issue. Though Windows tells you that localhost resolution is handled by DNS. But on my desktop, I have 127.0.0.1 kubernetes.docker.internal as a line in my hosts file which was added by Docker Desktop for Windows.

@TotallyInformation, I believe the fundamental problem here is that the connection to mosquitto fails if ipv6 is used. Do you know whether the default mosquitto install on Windows prevents IPv6? Looking at the docs it appears that, to disable ipv6, the mosquitto conf file would have to contain socket_domain ipv4. If there is no socket_domain setting in the config file then mosquitto will listen on both.

@tree-frog how did you install mosquitto, and have you made any changes to the config files?

Honestly, I've not tried. I don't run Mosquitto on Windows because I only use it for work, development, entertainment, .... :grin: Like most people, I have a small server that runs ... well, servers.

Did you say how you have your listener configured in Mosquitto?


socket_domain [ ipv4 | ipv6 ]

By default, a listener will attempt to listen on all supported IP protocol versions. If you do not have an IPv4 or IPv6 interface you may wish to disable support for either of those protocol versions. In particular, note that due to the limitations of the websockets library, it will only ever attempt to open IPv6 sockets if IPv6 support is compiled in, and so will fail if IPv6 is not available.

Set to ipv4 to force the listener to only use IPv4, or set to ipv6 to force the listener to only use IPv6. If you want support for both IPv4 and IPv6, then do not use the socket_domain option.

Not reloaded on reload signal.

Note the comment about the websockets library. Not sure if that applies here. However, I note that the mosquitto log should say which interfaces were activated and will say whether the ip4/ip6 versions were used.

Sorry, I thought that you did run such things on Windows.

it isn't me that has the problem, I don't run windows at all (except for Fusion 360 in a VM). I am trying to understand why the OP has the problem, so that we will know the answer next time it comes up.

Not a problem. I have run Mosquitto and InfluxDB/Grafana on Windows but honestly, I think we can all agree that Windows is much better as a desktop OS than a server! :grin: I'm too used to the Windows way of doing things to be comfortable switching even though I do have both MacOS and Linux to hand if needed. Having started in the IBM world >40yrs ago and coming up through OS/2 and every version of LAN Manager and Windows, it is a hard habit to break.

But even so, I only use Windows for my daily-driver workstation and laptops. For servers, I use Linux and have done for many years. Debian is my server OS of choice.

Wasn't aimed at you, I probably selected the wrong previous post.

Colin,

It appears to me that this is in concert with Node.js, Mosquitto MQTT and Windows as it is configured as well. I "usually" have IPv6 disabled on these machines. But not always. I realize there are things at play on my settings and configuration side that I'll need to verify. Thank you very much for looking into this. I'll have more time next week to look at the details on my configuration on Mosquitto and then the IPv6 configuration on that Windows 10 PC.

I have a path forward at present to rename the localhost tag to 127.0.0.1 which is acceptable for now. Please note that this caused issues on upgrade and porting code which I did have to puzzle through how to get it working. I believe this should be understood and I will certainly assist you as much as possible and time permitting.

Kind Regards,

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.