0
votes

I'm having trouble connecting to my Mosquitto broker from the Paho MQTT Javascript client version 1.1.0. I was previously using version 1.0.1, but I decided to change, because I need to use wildcards, which I think they are not supported in version 1.0.1, because they don't work.

To connect in version 1.0.1 I was doing this:

host=192.168.1.42
port=9873
id="whatever"
mqtt = new Paho.MQTT.Client(host,port,id);

In version 1.1.0, this way of connecting doesn't work. I saw an explanation here and I tried it like this:

mqtt = new Paho.Client("wss://192.168.1.42/mqtt",id);

This results in an error saying that Firefox cannot establish a connection to wss://192.168.1.42/mqtt.

What is the right way of connecting using version 1.1.0?

1

1 Answers

0
votes

Wildcard subscriptions will work at any version of the Paho Javascript client. But anyway.

As stated in the docs, the Client constructor host field can be one of the following:

the address of the messaging server, as a fully qualified WebSocket URI, as a DNS name or dotted decimal IP address.

You appear to be using a none standard port (9873 vs 443) for your WebSocket listener, so you are going to need to include the port number in the URI.

mqtt = new Paho.Client("wss://192.168.1.42:9873/mqtt",id);