Problem with websockets


I used to use mqtt with mosquitto. Now i want to switch. The bare mqtt works with hiveMQ (hivemq-ce-2020.2), the web sockets unfortunately not. From the config.xml:




With the test script [1] I don’t get a connect while it works with the old mosquitto server:

paho.mqtt.client.WebsocketConnectionError: WebSocket handshake error
But with curl I get an understandable error message from hiveMQ:
$ curl
not a WebSocket handshake request: missing upgrade

What am I doing wrong? Grateful for hints.

Hi @Fantaa,

Glad to see you want to switch to HiveMQ CE.
Unfortunately the formatting of your config.xml appears to be messed up.
You can find the information on how to configure a websocket listener here.
Seems like the xml tags get removed.
I would guess that you are running in to a mismatch between your configured websocket path ("/") and what the paho library uses (either “/mqtt” or “/ws”)
See this StackOverFlow question.

Hope this helps.

1 Like


thanks for your answer that helped me. I don’t know when I turned /mqtt to / (probably when I was still experimenting with hivemq). But with the change to /mqtt everything worked as it should.