2

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.

enter image description here

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.

enter image description here

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.

Dhanushka Dolapihilla
  • 1,115
  • 3
  • 17
  • 34
  • Which version of mosquitto did you build? 1.4.7 states adding support for websockets version 1.6. Might be worth trying that combination – hardillb Jan 19 '16 at 11:34
  • @hardillb I initially tried mosquitto 1.4.7 with libwebsockets 1.4 which was built without an issue. I tried the 1.4.7 and 1.6 combination and there was a whole lot of build errors. I will edit the question to show the errors please give me your opinion or a possible fix – Dhanushka Dolapihilla Jan 20 '16 at 04:50
  • I managed to get it working with mosquitto 1.4.7 and libwebsockets 1.5 although im still curious about the way how other combinations didnt work out – Dhanushka Dolapihilla Jan 20 '16 at 06:20

1 Answers1

0

I managed to get mosquitto built with websocket support by using mosquitto 1.4.7 and libwebsockets 1.5 without a problem.

Dhanushka Dolapihilla
  • 1,115
  • 3
  • 17
  • 34