Search code examples
amazon-web-servicesiotlifecycleaws-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. 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. When connection to the device is lost it takes approximately 7 to 8 seconds for AWS IoT to send out this message:

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?


Solution

  • 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.

    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.