[MQTT Web Client] Can't connect to broker
Web icon
Forge component by Barduino
Application Type
Traditional Web

Hi, so in trying your web demo and installing in my environment, i'm unable to connect to the broker.

I don't get an error or anything, just refuses to connect with no exceptions thrown. Can you please review the code and let me know if it can be fixed or if i'm just doing something incorrect.

The most common reason for a connection refused with and MQTT client is that it cannot reach the server itself. 

Where is the MQTT server located? Is it on a machine in your own network or on a public machine?

If it is on your own network are you using the public IP or the internal IP?  If the public IP have you setup forwarding rules on your router?

Do you have authentication on the MQTT connection?

What port is the MQTT listening on and has that been specified correctly in the connection details?

Is your MQTT setup to use https (SSL)? If so are you using a self signed certificate or a purchased certificate?

using hiveMQ. But, try their web demo and tell me if you can get it to work. I click on test connection and connect and nothing happens.

NO authentication, just their public facing MQTT server.

Hi Preston,

Open your console to see the logs.

test.mosquitto.org is a public mqtt broker and very slow, increase your time out for the connection to complete.


IT's working now, but whenever i click on publish message, i get the message but it says undefined, undefined. This is on mine and the example TRY that's hosted here.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.