aws-amplify/aws-sdk-ios

MQTT cannot connect

weidongliu opened this issue · 4 comments

Describe the bug
Disconnected and then connected multiple times with no response. Appears at specific time:
2024/05/16 09:20:37:849 I connected mqtt but there was no response, then I disconnected at 2024/05/16 09:20:58:648
2024/05/16 09:22:44:309 I connected mqtt but there was no response, then I disconnected at 2024/05/16 09:29:54:527
2024/05/16 09:30:11:509 I connected mqtt but there was no response, then I disconnected at 2024/05/16 09:36:42:382
According to the above time point, I found that when connecting to mqtt, the log prints Websocket is created and opened until I disconnect, there is no log in the middle, which is different from the normal connection log.
image

Areas of the SDK you are using (AWSMobileClient, Cognito, Pinpoint, IoT, etc)?
AWSIOT
AWSMobileClient

Environment(please complete the following information):

  • SDK Version: 2.33.10
  • Dependency Manager: Cocoapods
  • Swift Version :5.x
  • Xcode Version: xcode15

Device Information (please complete the following information):

  • Device: iphone11
  • iOS Version: iOS16.6.1

Logs
mqttlog.txt

Thank you for posting this. Our team will investigate and post updates to the ticket.

Have you found the reason? @thisisabhash

@weidongliu Can you help clarify what is the expected behavior and what is the behavior you're observing?

At 2024/05/15 15:57:46, the app is started and iotDataManager?.connectUsingWebSocket(withClientId: uuid, cleanSession: true, statusCallback: mqttEventCallback) is called to connect successfully. Then at 2024/05/15 15:58:14, the app enters the background, and until 2024/05/16 09:19:20, the app is opened. At this time, the application process is not killed by the system, and the iot sdk will automatically reconnect to mqtt. At 2024/05/16 09:19:24, the callback connection is successful. At 2024/05/16 09:19:30:765, iotDataManager?.disconnect() is called to disconnect successfully. Then at 2024/05/16 09:20:37, I called iotDataManager?.connectUsingWebSocket(withClientId: uuid, cleanSession: true, statusCallback: mqttEventCallback) but there was no callback for successful connection. Until 2024/05/16 09:20:58, I called otDataManager?.disconnect() to disconnect. The subsequent connections were unsuccessful. Please help me find the reason from the log. @phantumcode