I have built mosquitto on Visual Studio with websockets enabled, using Cmake to generate the project files. I used libwebsockets-1.4 .
I ran this broker with a websocket listener, and as following image it started listening on port 8000 through websockets.
Now I used the PAHO websocket client and tried to connect to the broker
client = new Paho.MQTT.Client("localhost", 8000, "abc123");
client.connect({onSuccess:onConnect});
function onConnect() {
console.log("onConnect");
}
Even with verbose logging i see nothing in the broker logs. And in the browser console I get
WebSocket connection to 'ws://localhost:8000/mqtt' failed: Error during WebSocket handshake: net::ERR_CONNECTION_RESET
After that I tried it with the test.mosquitto.org:8080
, and it got connected with no issue.
PS : I then tried mosquitto 1.4.7 and libwebsocket 1.6 combination which resulted in following build errors, please suggest me a fix.
Next attempt was with mosquitto 1.4.2 and libwebsockets 1.4 , had no issue building mosquitto with it. When i used a regular tcp client it worked fine, when a connect message from a websocket client was sent mosquitto.exe crashes.
What may have gone wrong and how can I overcome this issue? Anyone who had successfully deployed mosquitto with websocket support on windows please help out.
I managed to get mosquitto built with websocket support by using mosquitto 1.4.7 and libwebsockets 1.5 without a problem.