I’m trying to connect mqtt broker with fixed clientID, it’s working fine but with several reconnect client disconnect and reconnect at very short intervals. Initializing connection from Android service onCreate and cleanup in onDestroy method.
So I saw the unique clientId elsewhere and this did lead me to what I think my issue is, which is actually an instance issue where I have multiple instances of my class that are subscribing with a single clientId so I think each instance is kicking the other instance off when it does it’s own connection flow.
Out of curiosity, when you connect again with the same clientId, do we expect it to kick the existing connection with that clientId? Or will it be rejected since that clientId is already used?
the broker must disconnect the previously connected client when a successful new connect with the same clientId occurs. This mechanism is called “client take-over”.