AWS IoT reconnect results in re-subscription of an unsubscribed topic

0

Hi,

I am writing an android app using Java which connects to AWS IoT mqtt using the aws-android-sdk-iot.

After making an initial connection to the broker, I do the following steps -

  1. Subscribe to topic A.
  2. Unsubscribe from topic A.
  3. Subscribe to topic B.
  4. Unsubscribe from topic B.

Now, to simulate an abnormal disconnect, I turn the phone off.

Since I am listening to the LifeCycle events, I see that the connection is disconnected after the keepalive limit expires.
On turning the phone on, reconnect is tried. Successful reconnection happens but I also see a successful subscription to the topic A.

I have unsubscribed from topic A already, so why do I see a re-subscription to that on reconnect?

I have tried setting needResubscribe() to false using setAutoResubscribe(false) on the ASWIotMqttManager but it did not make a difference.

Please let me if this is expected behavior or something going wrong here.

Thanks!

demandé il y a 5 ans331 vues
1 réponse
0

Sorry, it was a code mistake. There was a bug in my handling of the connectionStatus = connected where I was trying to subscribe to the group.

répondu il y a 5 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions