Karmdip joshi
Karmdip joshi

Reputation: 160

How to connect MQTT on HTTPS server?

We are facing the issue in MQTT connection in HTTPS server. Sometimes it is working fine and sometimes it is getting an error like below.

WebSocket connection to 'wss://MYHOST:8083/mqtt' failed: Error in connection establishment: net::ERR_INSECURE_RESPONSE

Let me share with you,

My mosquitto.conf file:

pid_file /var/run/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
include_dir /etc/mosquitto/conf.d
listener 1883


listener 8083 
protocol websockets
certfile /etc/mosquitto/certs/myhost.crt
cafile /etc/mosquitto/certs/ca.crt
keyfile /etc/mosquitto/certs/myhost.key

My Mosquitto WebSocket config file:

host = 'MYHOST'; // hostname or IP address 
port = 8083;
topic = 'TOPIC'; // topic to subscribe to
useTLS = true;
username = "";
password = "";
path = "/mqtt";
cleansession = true;

Please give me solution for this.

Thanks!

Regards, Karmdip Joshi

Upvotes: 1

Views: 5754

Answers (1)

kiran malvi
kiran malvi

Reputation: 1025

I was getting same error before few days and got solution from hardillb.

Pls follow below stackoverflow url and try it!!

Websocket is not working with SSL

Thanks.

Upvotes: 3

Related Questions