Can't access using websockets running on Windows
I think there is a bug in Windows installer in version 2.0.14 when trying to access via websockets
Summary version 1.6.9 and version 2.0.9a work for me but not version 2.0.14
See here for background https://discourse.nodered.org/t/cant-connect-to-local-mqtt-broker-using-websockets/56035/15?u=cymplecy
I can confirm this issue. It affects versions 2.0.12, 2.0.13 & 2.0.14.
WORKAROUND:
- Add "socket_domain ipv4" to the end of the config
See my stackoverflow post here for more information: https://stackoverflow.com/questions/70643455/mosquitto-no-websocket-connection-since-version-02-0-12#new-answer
Confirmed with a fresh install of 2.0.14 running under Windows 11. Using a basic configuration (as below) appears to start up successfully (nothing unusual logged) but connection attempts fail (nothing is logged).
allow_anonymous true
listener 9001
protocol websockets
Adding socket_domain ipv4 (full configuration below) resolves the issue. I have not looked into why this helps but can confirm that it does.
allow_anonymous true
listener 9001
protocol websockets
socket_domain ipv4
Thanks for finding the workaround Confirm it works for me on 2.0.14
Thanks! This really took me some time to find out and should work by default. Using 2.0.15 and windows 10 with local broker and clients.
Had the same problem with 2.0.15 and Windows 11.
Connection worked with:
socket_domain ipv4
Thank you!
The issue is still there with this version:
mosquitto version 2.0.18
mosquitto is an MQTT v5.0/v3.1.1/v3.1 broker.
I had to add above to make it work
I'm having the same issue in the version 2.0.20 for mosquitto broker, and i'm using windows 11 but just adding socket_domain line to the conf file didn't worked for me, can someone enlighten me?
can someone enlighten me?
The socket_domain ipv4 neds to be in the relevant listener section (so chucking it just under protocol websockets is probably the right spot). If this does not work please edit your comment, and add the contents of your mosquitto.conf. Please note that I have not looked into why this works (or why websockets does not work by default under windows).
My conf file looks like this:
allow_anonymous true
#HTTP listener
listener 1883
#Websocket listener
listener 9001
protocol websockets
socket_domain ipv4
i don't know why i keep getting these error messages
1732788911: Error: Websockets support not available.
1732788911: Error found at C:\Program Files\mosquitto\mosquitto.conf:8.
1732788911: Error: Websockets support not available.
I think this means that the broker isn't compiled with websocket support.
also, I have a vague memory that the socket_domain option is ignored for webosckets due to issues with libwebsockets
So i would've to compile it from source with libwebsockets support, right?
yes
So i would've to compile it from source with libwebsockets support, right?
See issue #3148, using an earlier version should help.