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

Duplicate mqtt-client-id's #206

Open
yodalived opened this issue Mar 26, 2021 · 0 comments
Open

Duplicate mqtt-client-id's #206

yodalived opened this issue Mar 26, 2021 · 0 comments

Comments

@yodalived
Copy link

this->m_client->setClientId(QString("qt-openzwave-%1").arg(settings->value("Instance", 1).toInt()));

This line creates an mqtt client id of "qt-openzwave-0". If you have installations across multiple machines, their mqtt-client-id will be duplicated on the MQTT server. Since an MQTT server can only have unique client-id's, the older connection gets kicked off. In my instance, I have a two instances running in Docker connecting to the same MQTT server, both trying to connect with the same client id.

1616742757: New client connected from 192.168.105.219:45764 as qt-openzwave-0 (p2, c1, k60).
1616742765: New connection from 172.18.0.1:50662 on port 1883.
1616742765: Client closed its connection.
1616742765: New connection from 172.18.0.1:50666 on port 1883.
1616742765: Client qt-openzwave-0 already connected, closing old connection.

Can this be changed so that there is a short random number instead of 0 to allow multiple instances to connect to a single MQTT server?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant