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!

질문됨 5년 전305회 조회
1개 답변
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.

답변함 5년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인