Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext
boost::mqtt5::mqtt_client::keep_alive

Assign the maximum time interval that is permitted to elapse between two transmissions from the Client.

Synopsis
boost::mqtt5::mqtt_client&
keep_alive(
    uint16_t seconds);
Description

A non-zero value initiates a process of sending a PINGREQ packet every seconds. If this function is not invoked, the Client assumes a Keep Alive interval of 60 seconds.

Parameters

Name

Description

seconds

Time interval in seconds.

Remarks

If the Server sends a Server Keep Alive, the Client will send a PINGREQ packet every Server Keep Alive seconds.

Attention

This function takes action when the client is in a non-operational state, meaning the async_run function has not been invoked. Furthermore, you can use this function after the cancel function has been called, before the async_run function is invoked again.


PrevUpHomeNext