MQTT Device Connection Error

#1

Hi,
I am facing issue while trying to run the MQTT client in my local machine.
As given in the docs, I followed the process, gave my device id,key and secret but got error at the point of:

// Connect to Losant.
device.connect();

Kindly suggest for solution.
Please find the screenshot of error.

Thanks
Ashish
losant_yyyyy

0 Likes

#2

Are there any firewalls potentially blocking port 8883 between you and Losant? If it was an authentication or some other issue like that, you would get an authentication error - connection refused means the connection never even made it to the Losant broker.

You could also try using mqtt over secure websockets (which uses port 443) and see if that works.

0 Likes