IPWorks IoT 2020 Python Edition

Questions / Feedback?

keep_alive_interval Property

The maximum period of inactivity the gateway should allow between receiving messages from the client.

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 gateway will allow the connection to be idle without receiving a message from the client. 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 consider them lost if they have not communicated within the keep_alive_interval. The gateway will activate the Will feature for lost clients.

To maintain the connection, the server must send a PINGREQ (ping request) packet within the keep_alive_interval seconds after the most recent message sent. For more see the ping method.

Similarly, if the class doesn't receive a PINGRESP (ping response) packet after multiple retransmissions of the PINGREQ packet, it should first try to connect to another gateway before trying to re-connect to the original one.

If keep_alive_interval is set to 0 (default), the server is not required to consider 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 IoT 2020 Python Edition - Version 20.0 [Build 8265]