Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mosquitto bridge connection to IoT failing periodically. #367

Closed
amit1rrr opened this issue Feb 1, 2017 · 1 comment
Closed

Mosquitto bridge connection to IoT failing periodically. #367

amit1rrr opened this issue Feb 1, 2017 · 1 comment

Comments

@amit1rrr
Copy link

amit1rrr commented Feb 1, 2017

I have a mosquitto instance running on an ec2 host. We have bridged this
to AWS IoT. Everything works fine except that the bridge looses connection
to IoT endpoint every now and then. Our restart_timeout setting is at 1
second. But all the messages in that 1-2 second period of re-connection are
lost. My ec2 instance and IoT endpoint are in the same region as well.

I am not sure if this is a bug in the mosquitto bridging connection or AWS IoT dropping the connection. But would want to know what's happening.

My bridge config is as follow:

#
# =================================================================
# Bridges to AWS IOT
# =================================================================

# AWS IoT endpoint, use AWS CLI 'aws iot describe-endpoint'
connection awsiot
address a3m62xf68nsc3x.iot.us-east-1.amazonaws.com:8883

# Specifying which topics are bridged
#topic awsiot_to_localgateway in 1
#topic localgateway_to_awsiot out 0
#topic both_directions both 1
topic GPSLog/# out 2
topic DeviceHealth/# out 2
topic DeviceLogs/# out 2
topic DriverConnection/# out 2
topic Staging/GPSLog/# out 2
topic Staging/DeviceHealth/# out 2
topic Staging/DriverConnection/# out 2

# Setting protocol version explicitly
bridge_protocol_version mqttv311
bridge_insecure false

# Added by Amit
bridge_attempt_unsubscribe false
try_private true
log_dest stdout
keepalive_interval 5
restart_timeout 0

# Bridge connection name and MQTT client Id,
# enabling the connection automatically when the broker starts.
cleansession true
clientid bridgeawsiot
start_type automatic
notifications false
log_type all

# =================================================================
# Certificate based SSL/TLS support
# -----------------------------------------------------------------
#Path to the rootCA
bridge_cafile /etc/mosquitto/certs/rootCA.pem

@amit1rrr
Copy link
Author

amit1rrr commented Feb 2, 2017

Closing it.

This was happening because I had another instance of mosquitto with same client ID trying to connect to same IoT endpoint. As per mqtt protocol, broker drops existing connection when it receives another connection with same clientID. So these instances kept disconnecting each other.

Resolution was to change the clientID.

@amit1rrr amit1rrr closed this as completed Feb 2, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Aug 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant