ios - 如何设置 AWSIoTManager 的自动重连尝试次数
问题描述
如何设置 AWSIoTManager 的自动重新连接尝试次数和重试限制?
这是Java示例:
aWSIotMqttManager = AWSIotMqttManager(..)
aWSIotMqttManager.maxAutoReconnectAttempts = 1
aWSIotMqttManager.setReconnectRetryLimits(1, 4)
解决方案
您可以在aws-sdk-ios
注册时为每个服务提供配置(如AWSIoTManager所示)
AWSServiceConfiguration
继承自 AWSNetworkingConfiguration
,它具有以下属性maxRetryCount
:
失败请求的最大重试次数。该值需要介于 0 和 10(含)之间。如果设置为高于 10,则变为 10。
例如(迅速):
let configuration = AWSServiceConfiguration(maxRetryCount: 7)
AWSIoTManager.register(with: configuration!, forKey: "USWest2IoTManager")
推荐阅读
- excel-formula - 消除数据验证列表中空白单元格值的方法
- scip - 我得到分段错误\更改 feastol dafault 值
- widget - 如何从颤动的无状态小部件中获取矩形
- url - 更改 cli 生成的 VueJS 项目的根路径
- javascript - Ember 发生错误:断言失败:在没有有效事件名称的情况下调用
- javascript - 为什么 '.attr("x", dx = d3.event.x)' 有效?
- c# - Azure 服务总线“分配的超时”异常
- php - Laravel 5.6 Passport oAuth2 无法使用 Guzzle 发出请求
- java - FlyWeight 设计模式
- php - 如何同时执行多个 MySql 查询?