aws-amplify / aws-sdk-ios

AWS SDK for iOS. For more information, see our web site:
https://aws-amplify.github.io/docs
Other
1.68k stars 885 forks source link

AWSIoT unsubscribe from topic isn't working #1547

Closed baljakbratislav closed 3 years ago

baljakbratislav commented 5 years ago

Describe the bug

To Reproduce Steps to reproduce the behavior: Subscribe to "AA" topic. Unsubscribe to "AA" topic. Subscribe to "BB" topic.

Current behavior Receiving events from both topics: from "AA" and "BB"

Expected behavior Receiving events only from last topic: from "BB"

Environment(please complete the following information):

Device Information (please complete the following information):

rohandubal commented 5 years ago

Hello @baljakbratislav

Could you please give the code snippet you are using to initialize the IoT client and make the subscribe call? That will help us identify the issue and reproduce it on our side.

Thanks, Rohan

baljakbratislav commented 5 years ago

Of course I can:

This is code for initialization

if let socketProtocol = socket?.socketProtocol, let host = socket?.host, let identityPoolId = socket?.identityPoolId {
            let endpoint = socketProtocol + "://" + host
            let iotEndPoint = AWSEndpoint(urlString: endpoint)
            let credentialProvider = AWSCognitoCredentialsProvider(regionType: .EUWest1, identityPoolId: identityPoolId)
            let configuration = AWSServiceConfiguration(region: .EUWest1, endpoint: iotEndPoint, credentialsProvider: credentialProvider)

            if let config = configuration {
                AWSIoTDataManager.register(with: config, forKey: "EUWest1IoTDataManager")
                AWSServiceManager.default()?.defaultServiceConfiguration = configuration
                let iotDataManager = AWSIoTDataManager.init(forKey: "EUWest1IoTDataManager")
                return iotDataManager
            }
        }

This is for connection iotDataManager?.connectUsingWebSocket(withClientId: UUID().uuidString, cleanSession: true) { [weak self] (status) in

And last but not the least: for subscription iotDataManager?.subscribe(toTopic: "topic", qoS: .messageDeliveryAttemptedAtLeastOnce) { [weak self] (message) in

If you have any more questions, feel free to ping me. @rohandubal

github-actions[bot] commented 3 years ago

This issue is stale because it has been open for 14 days with no activity. Please, provide an update or it will be automatically closed in 7 days.

github-actions[bot] commented 3 years ago

This issue is being automatically closed due to inactivity. If you believe it was closed by mistake, provide an update and re-open it.