IPWorks IoT 2020 JavaScript Edition

Questions / Feedback?

KeepAliveInterval Property

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


 getKeepAliveInterval(): number;

 setKeepAliveInterval(keepAliveInterval: number): void;

Default Value



The KeepAliveInterval, 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 KeepAliveInterval 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 KeepAliveInterval, and must consider them lost if they have not communicated within the KeepAliveInterval. 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 KeepAliveInterval 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 KeepAliveInterval 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".

This property is not available at design time.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks IoT 2020 JavaScript Edition - Version 20.0 [Build 8265]