Mqtt connection problem (socket error on client <unknown>, disconnecting.)

4,319 views
Skip to first unread message

Daniele Carvalho

unread,
Sep 7, 2017, 5:59:19 AM9/7/17
to MQTT
Hello,


I have installed mosquitto broker on VPS and I installed Certbot for Let's Encrypt Certificates form https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-the-mosquitto-mqtt-messaging-broker-on-centos-7

As a c client we are using ATSAMD21-XPRO + WINC1500 development kit. 

My base code is the mqtt_chat_example project from Atmel Studio 7. 

I have a problem with my mqtt connection it constatly says 'socket error on client <unknown>, disconnecting.' 

mqtt connect ECONNRESET error 104 Connection reset by peer.


My config file:

------------------------------- mosquitto.conf ----------------------------------

allow_anonymous false
password_file /etc/mosquitto/passwd

#mqtt default port no encryption
listener 1883 localhost

# mqtt port encrypted
listener 8883
require_certificate false
cafile /etc/letsencrypt/live/mqtt.easyin.com.pt/chain.pem
certfile /etc/letsencrypt/live/mqtt.easyin.com.pt/cert.pem
keyfile /etc/letsencrypt/live/mqtt.easyin.com.pt/privkey.pem
tls_version tlsv1.2

#websocket port
listener 8083
protocol websockets
cafile /etc/letsencrypt/live/mqtt.easyin.com.pt/chain.pem
certfile /etc/letsencrypt/live/mqtt.easyin.com.pt/cert.pem
keyfile /etc/letsencrypt/live/mqtt.easyin.com.pt/privkey.pem

# second websocket port
listener 8085
protocol websockets
cafile /etc/letsencrypt/live/mqtt.easyin.com.pt/chain.pem
certfile /etc/letsencrypt/live/mqtt.easyin.com.pt/cert.pem
keyfile /etc/letsencrypt/live/mqtt.easyin.com.pt/privkey.pem
------------------------------------------------------------------------------------------------

What is the problem? 

Thank you in advance. 

Kind regards, 
Daniele

Ravi Subramanian

unread,
Sep 12, 2017, 6:11:20 AM9/12/17
to MQTT
Danielle

For some reason, the broker is disconnecting your connection.  Are you using a secure connection port (8883) for connection or a normal one (1883)

Regards
Ravi

Daniele Carvalho

unread,
Sep 26, 2017, 4:36:10 AM9/26/17
to MQTT
I'm using a secure connection on port 8883 but i'm redirecting the domain that I use as the broker to my vps.

Reply all
Reply to author
Forward
0 new messages