简体   繁体   English

有没有办法缩短在 AWS IoT 中触发生命周期事件的时间?

[英]Is there a way to lower the time for a lifecycle event to be triggered in AWS IoT?

So my issue is rather simple in all honesty.所以老实说,我的问题相当简单。 I'm trying to see if there is a way to trigger Lifecycle Events within AWS IoT much quicker.我正在尝试查看是否有一种方法可以更快地触发 AWS IoT 中的生命周期事件 So far my code is as follows on connect:到目前为止,我的代码在连接上如下:

mqttc.connect(aws_iot_endpoint, port=443, keepalive=1)

The value for keepalive cannot be lower than 1, as it's not enough time for the thing to connect to AWS. keepalive 的值不能低于 1,因为它没有足够的时间连接到 AWS。 When connection to the device is lost it takes approximately 7 to 8 seconds for AWS IoT to send out this message:当与设备的连接丢失时,AWS IoT 大约需要 7 到 8 秒才能发送此消息:

MQTT_KEEP_ALIVE_TIMEOUT

I was wondering if there is any way to decrease that time even further?我想知道是否有任何方法可以进一步减少该时间? Is using AWS IoT Events the way forward?使用 AWS IoT Events 是前进的方向吗?

If your keep-alive is set to 1 second, then MQTT_KEEP_ALIVE_TIMEOUT should be 1.5x which is 1.5 seconds, not 7-8 seconds.如果您的 keep-alive 设置为 1 秒,那么MQTT_KEEP_ALIVE_TIMEOUT应该是1.5x ,即 1.5 秒,而不是 7-8 秒。

Make sure that you're also setting your ping timeout (in ms) to a value shorter than 1000ms as otherwise, AWS may just default to 3 seconds for ping timeout.确保您还将 ping 超时(以毫秒为单位)设置为小于 1000 毫秒的值,否则,AWS 的 ping 超时可能仅默认为 3 秒。

Keep Alive cannot be set to 1 sec per AWS docs .根据 AWS 文档,Keep Alive 不能设置为 1 秒。 Values less than 30 are set to 30.小于 30 的值设置为 30。

The default keep-alive interval is 1200 seconds.默认保持活动时间间隔为 1200 秒。 It is used when a client requests a keep-alive interval of zero.当客户端请求保持活动间隔为零时使用它。 If a client requests an interval > 1200 seconds, the default interval is used.如果客户端请求的时间间隔 > 1200 秒,则使用默认时间间隔。 If a client requests a keep-alive interval < 30 seconds but > zero, the server treats the client as though it requested a keep-alive interval of 30 seconds.如果客户端请求的保持活动间隔 < 30 秒但 > 零,则服务器将客户端视为请求 30 秒的保持活动间隔。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM