Skip to content

After the device system sleeps and wakes up again, the PING request is not sent #2760

Open
@liangliang-zhll

Description

@liangliang-zhll

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions