Description
hi:
I have a problem here, please help me guide, thank you!
I am using libmosquito to develop mqtt client applications;using mosquitto_connecte () to connect the mqtt broker, and set keepalive time is 3 minutes. When a PINGREQ request is sent and the PINGRESP response message is received, I trigger to let my device system sleep for 2 minutes, and then wakes up the device system. After waiting for 1 minute, the PINGREQ request is not sent;
I found mosquito_ loop_ misc()--> mosquitto__ check_ keepalive() --> mosquitto_ time() --> clock_ gettime(CLOCK_MONOTONIC, &tp); The current time obtained is the system running time. When the system sleeps, it will not be counted. So when the system wakes up, the two minutes of the system sleep will not be counted, so waiting for one minute will not send a PINGREQ request;
Excuse me: 1) Does mosquito not support the keepalive function of the system sleep scenario? 2) Is there any good solution to this problem?
(Can we use clock_gettime (CLOCK_BOOTTIME,&tp) to solve the above problem?)
Please help to answer it, thank you!