如何设置AWSIoTManager的自动重新连接尝试次数

时间:2019-05-17 08:38:06

标签: ios amazon-web-services aws-sdk aws-iot

如何设置AWSIoTManager的自动重新连接尝试次数和重试限制?

这是java示例:

aWSIotMqttManager = AWSIotMqttManager(..)
aWSIotMqttManager.maxAutoReconnectAttempts = 1
aWSIotMqttManager.setReconnectRetryLimits(1, 4)

1 个答案:

答案 0 :(得分:1)

aws-sdk-ios上,您可以为每个服务提供注册配置(如AWSIoTManager所示)

AWSServiceConfiguration inherits from AWSNetworkingConfiguration,其中具有属性maxRetryCount

  

失败请求的最大重试次数。该值必须介于0和10之间(含0和10)。如果设置为大于10,则变为10。

例如(快速):

let configuration = AWSServiceConfiguration(maxRetryCount: 7)
AWSIoTManager.register(with: configuration!, forKey: "USWest2IoTManager")