keep alive timer of MQTT

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
AkKo_4458241
Level 2
Level 2

Hello.

I want to change the settings of the keep alive timer of MQTT,

Should I change the defined value of "WICED_AWS_MQTT_KEEP_ALIVE_TIMEOUT" in "aws_common.h"?

Is there a setting value range?

I want to set it to 600 seconds, but it will be disconnected 600 seconds after the last access.

Is there a solution?

Thank you.

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
Aditi_B
Moderator
Moderator
Moderator
500 replies posted 5 questions asked 250 replies posted

Hi,

The connection inactivity (keep-alive interval) for MQTT connections is between 30-1200 seconds as part of the MQTT CONNECT message for AWS IOT.

Following link should help

https://docs.aws.amazon.com/iot/latest/developerguide/limits-iot.html

Following attached code should help

In the sample code, if the button isn't pressed to publish within keep alive time the connection is closed.

Thanks and Regards

View solution in original post

0 Likes
4 Replies
Aditi_B
Moderator
Moderator
Moderator
500 replies posted 5 questions asked 250 replies posted

Hi,

Yes, you can change the value of the Macro "WICED_AWS_MQTT_KEEP_ALIVE_TIMEOUT" in "aws_common.h" file to your specified value of 600 seconds. You can refer to "aws_mqtt.c" where the "keep_alive" interval is replaced with this Macro. The keep_alive is a uint16_t variable.

Thanks

0 Likes

Hello,

Thank you very much for your answer.

I tried with "600" and it was disconnected 600 seconds after the last access.
And,I tried with "480" and it was not disconnected even after 480 seconds since the last access.

Is it a problem on the AWS server side to be disconnected when the value is "600"?

Thank you.

0 Likes
lock attach
Attachments are accessible only for community members.
Aditi_B
Moderator
Moderator
Moderator
500 replies posted 5 questions asked 250 replies posted

Hi,

The connection inactivity (keep-alive interval) for MQTT connections is between 30-1200 seconds as part of the MQTT CONNECT message for AWS IOT.

Following link should help

https://docs.aws.amazon.com/iot/latest/developerguide/limits-iot.html

Following attached code should help

In the sample code, if the button isn't pressed to publish within keep alive time the connection is closed.

Thanks and Regards

0 Likes

Hello,

Thank you very much for your answer.

I'll try.

 

thank you.

0 Likes