Search code examples
websocketconnectionmqttmosquitto

Mosquitto no websocket connection since version 02.0.12 (Windows specific)


today I wanted to set up a simple mosquitto server on my windows machine for testing. I am using "MQTT Explorer" for convenience and downloaded the latest 2.0.14 mosquitto binaries for windows (I am using Windows 10). However I am unable to connect to my local server with Mosquitto 2.0.14, 2.0.13 and 2.0.12.

My connection is successful with 2.0.11, 2.0.10, 2.0.9a and 2.0.7 but these versions only work when I also have a standard http listener in the config (which I do not want since later on I only want one wss listener).

This is the config I am using:

allow_anonymous true

#HTTP listener
listener 1883

#Websocket standard listener
listener 9001
protocol websockets

This is the server output I get when using 2.0.14, 2.0.13 or 2.0.12 after my connection failed: enter image description here

And this is the output when using 2.0.11, 2.0.10, 2.0.9a or 2.0.7 but without the http listener in the config: enter image description here

Can anyone reproduce this behaviour or tell me where I messed up?


Solution

  • As per the comments I was able to duplicate the issue with Mosquitto 2.0.14 and an issue has been raised.

    A workaround is to add socket_domain ipv4 into the configuration - e.g.

    allow_anonymous true
    
    listener 9001
    protocol websockets
    socket_domain ipv4
    

    I came across option in this issue and it does appear to fix the issue. Note that I have not looked into why this fixes the issue so this should be considered a temporary workaround until the issue mentioned above is updated.