net: mqtt: Added event for MQTT ping response.

There are scenarios where there is a NAT firewall in between MQTT
client and server. In such case, the NAT TCP timeout may be shorter
than MQTT keepalive timeout and TCP timeout. The the MQTT ping
request message is dropped by the NAT firewall, so that it cannot be
received by the server, resulting in void MQTT ping response message.
There is no TCP FIN or RST at all. The application looks hang-up
until TCP timeout happens on the client side, which may take too
long.

Therefore, the event MQTT_EVT_PINGRESP is added to inform the
application that the route between client and server is still valid.

Signed-off-by: PK Chan <pak.kee.chan@nordicsemi.no>
This commit is contained in:
PK Chan 2020-03-10 18:03:51 +08:00 committed by Jukka Rissanen
commit 9f9e00a62d
2 changed files with 5 additions and 3 deletions

View file

@ -75,7 +75,10 @@ enum mqtt_evt_type {
MQTT_EVT_SUBACK,
/** Acknowledgment to a unsubscribe request. */
MQTT_EVT_UNSUBACK
MQTT_EVT_UNSUBACK,
/** Ping Response from server. */
MQTT_EVT_PINGRESP,
};
/** @brief MQTT version protocol level. */