IPWorks MQ 2020 Python Edition

Questions / Feedback?

keep_alive_interval Property

The maximum period of inactivity the class will allow before sending a keep-alive packet.

Syntax

def get_keep_alive_interval() -> int: ...
def set_keep_alive_interval(value: int) -> None: ...

keep_alive_interval = property(get_keep_alive_interval, set_keep_alive_interval)

Default Value

0

Remarks

The keep_alive_interval, if set to a non-zero value, is the maximum number of seconds that the class will allow the connection to be idle before sending a PINGREQ (ping request) packet to the server. The value of keep_alive_interval is sent to the server when connect is called; it cannot be changed when the class is already connected.

MQTT servers are required to measure periods of inactivity for all clients who specify a non-zero keep_alive_interval, and must disconnect them if they have not communicated within 1.5 times keep_alive_interval.

Similarly, if the class doesn't receive a PINGRESP (ping response) packet within keep_alive_interval seconds after sending a PINGREQ packet, it will disconnect from the server.

If keep_alive_interval is set to 0 (default), keep-alive functionality is disabled entirely. In this case, the class will not send any PINGREQ packets, and the server is not required to close the connection due to inactivity.

Note that, regardless of keep-alive settings, the server is always free to disconnect clients it deems "unresponsive".

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks MQ 2020 Python Edition - Version 20.0 [Build 8162]