<?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>nrf9160 mqtt keep alive longer than 30 minutes not working</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/79780/nrf9160-mqtt-keep-alive-longer-than-30-minutes-not-working</link><description>sdk: 1.6 
 modem fw: 1.2.3 
 
 Hi, 
 Been trying to test mqtt every which way and not getting any success with mqtt keep alive longer than 30 minutes, the mqtt connection is only maintained when the keepalive is less than 30 minutes. Two problems are</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 20 Apr 2022 11:22:11 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/79780/nrf9160-mqtt-keep-alive-longer-than-30-minutes-not-working" /><item><title>RE: nrf9160 mqtt keep alive longer than 30 minutes not working</title><link>https://devzone.nordicsemi.com/thread/363882?ContentTypeID=1</link><pubDate>Wed, 20 Apr 2022 11:22:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c40affd5-dbb8-4751-bf09-a71c2a6ab55a</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Thanks for providing the update.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Just to clarify, has Bell or Rogers support confirmed the NAT timeout on the network?&amp;nbsp;&lt;span&gt;NAT timeout is considered as a &amp;quot;chain&amp;quot;, meaning that you are only &amp;quot;as strong as the weakest link&amp;quot; - i.e. if your one of your network chains has a lower than 350 seconds, that will be the NAT timeout for this specific network/APN.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Perhaps&amp;nbsp;&lt;a href="https://www.gsma.com/iot/wp-content/uploads/2022/02/2022.03-GSMA-Energy-Efficiency-for-Mobile-IoT-1.pdf"&gt;GSMA&amp;#39;s Whitepaper on Improving Energy Efficiency for Mobile IoT.&lt;/a&gt;&amp;nbsp;can offer some insight on this.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 mqtt keep alive longer than 30 minutes not working</title><link>https://devzone.nordicsemi.com/thread/363411?ContentTypeID=1</link><pubDate>Tue, 19 Apr 2022 04:18:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7918d930-5a0f-4756-8cc0-f6a8d708fc53</guid><dc:creator>Stratosphere</dc:creator><description>&lt;p&gt;Hi Oyvind,&lt;/p&gt;
&lt;p&gt;I have attached the updated modem trace.&lt;/p&gt;
&lt;p&gt;once again: keepalive is 40 minutes&lt;/p&gt;
&lt;p&gt;mqtt publish freq: 40 min&lt;/p&gt;
&lt;p&gt;modem fw: 1.2.3&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;ESP is connecting via Wifi. I have confirmed with Bell that connections of any sort are not being reset or terminated by them in 30 minutes. IP lease time is also in hours/days not in minutes.&lt;/p&gt;
&lt;p&gt;I do not want 30 minute keep alive. I want &amp;gt;12 hour keepalive. Our use-case for asset tracking requires 12 hours pings on idle and more frequent pings on motion. so we could be sending 5-10 pings on a daily basis for typical application. I do not want to establish a new connection every time as it adds up on power consumption as well as data requirements on reconnection especially on TLS. TLS session caching does reduce data consumption and connection time but it is still more than what a keepalive duration of 12 hours would allow us to acheive.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/trace_2D00_2022_2D00_04_2D00_19T03_2D00_16_2D00_06.348Z.bin"&gt;devzone.nordicsemi.com/.../trace_2D00_2022_2D00_04_2D00_19T03_2D00_16_2D00_06.348Z.bin&lt;/a&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/2022_2D00_04_2D00_19-_2D00_-uart-output.txt"&gt;devzone.nordicsemi.com/.../2022_2D00_04_2D00_19-_2D00_-uart-output.txt&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 mqtt keep alive longer than 30 minutes not working</title><link>https://devzone.nordicsemi.com/thread/363137?ContentTypeID=1</link><pubDate>Wed, 13 Apr 2022 09:17:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:235da549-33b7-4b88-aad9-a05ff611d55c</guid><dc:creator>&amp;#216;yvind</dc:creator><description>[quote user="Stratosphere"]I know my mqtt server does not disconnect because I have tried keepalive to the same server on ESP32 as well and desktop Mqtt client and they both keep the connection.[/quote]
&lt;p&gt;Is the ESP32 connecting via&amp;nbsp;cellular or WiFi?&amp;nbsp;&lt;/p&gt;
[quote user=""]mqtt keep alive longer than 30 minutes[/quote]
&lt;p&gt;Can you provide some information for why you want to have 30 minutes keepalive? This for our developers to understand what you are trying to achieve.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote user="oys"]Please note that due to Easter Holiday, our tech support team is lower staffed than normal, and a delay in answers must be expected.[/quote]&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 mqtt keep alive longer than 30 minutes not working</title><link>https://devzone.nordicsemi.com/thread/362940?ContentTypeID=1</link><pubDate>Tue, 12 Apr 2022 04:49:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:93dfc7c9-00af-4752-b802-23830be32fe9</guid><dc:creator>Stratosphere</dc:creator><description>[quote userid="77062" url="~/f/nordic-q-a/79780/nrf9160-mqtt-keep-alive-longer-than-30-minutes-not-working/362752#362752"]Your&amp;nbsp;network does not provide PSM, i.e. GPS would not work if not setting modem function to e.g. Flight Mode.&amp;nbsp;[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="mceItem mceNonEditable mceQuote" id="mceQuote0"&gt;...&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I tried many configurations both with and without PSM. This output i shared is where i disable PSM.&lt;/p&gt;
[quote userid="77062" url="~/f/nordic-q-a/79780/nrf9160-mqtt-keep-alive-longer-than-30-minutes-not-working/362752#362752"]Could you please explain what keepalive you are referring to, MQTT or the network?&amp;nbsp;[/quote]
&lt;p&gt;As per the title of the ticket, I am referring to MQTT keepalive of more than 30 minutes.&lt;/p&gt;
[quote userid="77062" url="~/f/nordic-q-a/79780/nrf9160-mqtt-keep-alive-longer-than-30-minutes-not-working/362752#362752"]The MQTT server you are connecting to, does this use TLS? Have you verified that the MQTT server does not disconnect device?[/quote]
&lt;p&gt;I have tried both with and without TLS, the result is no different.&amp;nbsp;&lt;br /&gt;I know my mqtt server does not disconnect because I have tried keepalive to the same server on ESP32 as well and desktop Mqtt client and they both keep the connection.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Modem trace as well as other files are attached.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/mqtt-_2D00_-keepalive-fail-30mins-_2D00_-trace-and-others.zip"&gt;devzone.nordicsemi.com/.../mqtt-_2D00_-keepalive-fail-30mins-_2D00_-trace-and-others.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 mqtt keep alive longer than 30 minutes not working</title><link>https://devzone.nordicsemi.com/thread/362752?ContentTypeID=1</link><pubDate>Mon, 11 Apr 2022 07:31:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88b33626-83f3-4f0d-8142-9f5adf084c7c</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Hello Noaman,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Please note that due to Easter Holiday, our tech support team is lower staffed than normal, and a delay in answers must be expected.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;First of all, from the logs you have provided I see the following&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;PSM Settings: +CPSMS: 1,,,&amp;quot;00100100&amp;quot;,&amp;quot;00000001&amp;quot;

CEREG: +CEREG: 5,1,&amp;quot;D6E4&amp;quot;,&amp;quot;086B9411&amp;quot;,7,,,&amp;quot;11100000&amp;quot;,&amp;quot;11100000&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Your&amp;nbsp;network does not provide PSM, i.e. GPS would not work if not setting modem function to e.g. Flight Mode.&amp;nbsp;&lt;/p&gt;
[quote user="Stratosphere"]I just cannot get the keep-alive period longer than 30 minutes to work. [/quote]
&lt;p&gt;Could you please explain what keepalive you are referring to, MQTT or the network?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;The MQTT server you are connecting to, does this use TLS? Have you verified that the MQTT server does not disconnect device?&lt;br /&gt;&lt;br /&gt;We will &lt;a href="https://infocenter.nordicsemi.com/topic/ug_trace_collector/UG/trace_collector/collect_modem_trace.html"&gt;need a modem trace&lt;/a&gt; for more information.&lt;br /&gt;&lt;br /&gt;Kind regards;&lt;br /&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 mqtt keep alive longer than 30 minutes not working</title><link>https://devzone.nordicsemi.com/thread/362690?ContentTypeID=1</link><pubDate>Sat, 09 Apr 2022 02:54:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1c0bfa6-bf04-4dcf-83cf-43b4e9ed27a4</guid><dc:creator>Stratosphere</dc:creator><description>&lt;p&gt;Hi Oyvind,&lt;/p&gt;
&lt;p&gt;I had given up on this until I had to come back to it just recently.&lt;/p&gt;
&lt;p&gt;Please find attached the Uart output with debug enabled. I just cannot get the keep-alive period longer than 30 minutes to work. I have even test disabled PSM, using edrx, using PSM of 5 minutes etc. to try and keep the connectiion with LTE network active. I also checked with Bell and Rogers support they both informed me that they do not put any such limitation on keeping the connection open. Bell also confirm that their IP lease time should be more than 4 hours and longer so the 30 minutes time out does not work.&lt;/p&gt;
&lt;p&gt;I was just thinking about how gps also does a cold-start if fixes are requested more than 30 mintues apart. Is there anything in the modem fw that resets the connection, closes the socket or clears the memory?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I am using mfw: 1.2.3&amp;nbsp;&lt;/p&gt;
&lt;p&gt;sdk 1.6&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Noaman&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/2022_2D00_04_2D00_27-_2D00_-1-hour-keep-Alive-_2D00_-socket-disconnect.txt"&gt;devzone.nordicsemi.com/.../2022_2D00_04_2D00_27-_2D00_-1-hour-keep-Alive-_2D00_-socket-disconnect.txt&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf9160 mqtt keep alive longer than 30 minutes not working</title><link>https://devzone.nordicsemi.com/thread/330412?ContentTypeID=1</link><pubDate>Tue, 21 Sep 2021 08:58:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:591180af-5716-46fa-bc9d-2d2f6e801bae</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Hello,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;A keepalive of more than 30 minutes can be problematic depending on network policies i.e. IP address lease time, etc.&lt;/p&gt;
&lt;p&gt;Can you please provide full log output, including information provided by &amp;quot;AT+CFUN?&amp;quot;&lt;/p&gt;
&lt;p&gt;Thanks.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>