<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>MQTT Keepalive</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/105334/mqtt-keepalive</link><description>We&amp;#39;re developing an nRF9160 based piece of hardware that will use Asset Tracker 2 and nRF Cloud. 
 We&amp;#39;re trying to understand what the &amp;quot;reported&amp;#39; &amp;quot;connection&amp;quot; status means in the Device Shadow. 
 I assume this refers to the status of the connection between</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 03 Nov 2023 13:05:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/105334/mqtt-keepalive" /><item><title>RE: MQTT Keepalive</title><link>https://devzone.nordicsemi.com/thread/453973?ContentTypeID=1</link><pubDate>Fri, 03 Nov 2023 13:05:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3cf15061-0d52-4497-8a3c-bacfbb9bb207</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;There are several services in-between the client and the server in this case, and it highly depends on what the NAT timeout in your network is:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/79780/nrf9160-mqtt-keep-alive-longer-than-30-minutes-not-working/363411"&gt;RE: nrf9160 mqtt keep alive longer than 30 minutes not working&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It is quite common that networks can have several minutes before a TCP connection is terminated (via. either firewall/NAT etc in the network chain). I would recommend that you try to reduce the KEEP_ALIVE and see what is working for your specific network. Alternative is to contact your tele-network provider and ask what the NAT timeout is, but it is generally easier to reduce the KEEPALIVE to a lower value until it starts keeping the connection successfully between each &amp;quot;ping&amp;quot;.&lt;/p&gt;
[quote user=""]But the reason for the loss of connection to the cloud is reported as &amp;quot;MQTT_KEEP_ALIVE_TIMEOUT&amp;quot;, and the &amp;quot;keepalive&amp;quot; timer is set to 1200.&amp;nbsp; So does that mean the if there is no MQTT activity for 1200 seconds that the cloud connection automatically shuts down?[/quote]
&lt;p&gt;No, it means that it will contact the server each configured KEEP_ALIVE_TIMEOUT (in seconds). If nothing happens in 1200 seconds, it will to a ping to the server to maintain the connection.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>