<?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 - issue with Connect ACK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/61609/mqtt---issue-with-connect-ack</link><description>Hi, I&amp;#39;m testing the MQTT implementation integrated in the NRF5 SDK. 
 This is my test environment: - A nRF52840 board with the MQTT publisher example from the SDK. - A Raspberry Pi 3 B+, with Ubuntu MATE (18.04.2 LTS (Bionic Beaver) kernel 4.15.0-1032</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 16 Jun 2020 21:36:27 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/61609/mqtt---issue-with-connect-ack" /><item><title>RE: MQTT - issue with Connect ACK</title><link>https://devzone.nordicsemi.com/thread/255363?ContentTypeID=1</link><pubDate>Tue, 16 Jun 2020 21:36:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bced87e5-8172-473b-9263-5f0b9556cb64</guid><dc:creator>Jose Forno</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;Sorry for the long delay.&lt;/p&gt;
[quote userid="26071" url="~/f/nordic-q-a/61609/mqtt---issue-with-connect-ack/251665"]Are you following a guide or something?&amp;nbsp;[/quote]
&lt;p&gt;Yes, I followed the IoT guide found in the infocenter.&lt;/p&gt;
&lt;p&gt;I put a break point inside the beginning of the mqtt_handle_packet() and also in MQTT_PKT_TYPE_CONNACK &amp;quot;switch/case&amp;quot;.&amp;nbsp;I also enabled the log in debug level in the mqtt library (in sdk_config.h).&lt;/p&gt;
&lt;p&gt;I tested again:&lt;/p&gt;
&lt;p&gt;- There&amp;#39;s no event generated in the 90 seconds lapsus.&lt;/p&gt;
&lt;p&gt;- Only after the 90 seconds both breakpoints happens.&lt;/p&gt;
&lt;p&gt;- There&amp;#39;s no output log.&lt;/p&gt;
&lt;p&gt;With this test I can answer your questions:&lt;/p&gt;
[quote userid="26071" url="~/f/nordic-q-a/61609/mqtt---issue-with-connect-ack/251665"]evt.result = evt.param.connack.return_code if this handler is called?[/quote]
&lt;p&gt;Yes. The handler is called but after the 90 seconds (as I told you before), i.e when the broker disconnect this client.&lt;/p&gt;
[quote userid="26071" url="~/f/nordic-q-a/61609/mqtt---issue-with-connect-ack/251665"]Do you get any other events in mqtt_handle_packet() at the time you would expect the MQTT_EVT_CONNACK event?[/quote]
&lt;p&gt;No, no other events detected.&lt;/p&gt;
[quote userid="26071" url="~/f/nordic-q-a/61609/mqtt---issue-with-connect-ack/251665"]The addresses that you have sensored from the screenshot, are they all the same?[/quote]
&lt;p&gt;Yes&lt;/p&gt;
[quote userid="26071" url="~/f/nordic-q-a/61609/mqtt---issue-with-connect-ack/251665"]Is the RPi using the correct address?[/quote]
&lt;p&gt;Yes.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;My question is , why the MQTT_EVT_CONNACK event is generated in the disconnection and not in the moment when the broker send it to the client?&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Note: I also tested the mosquitto broker with tls-psk using &amp;quot;&lt;/span&gt;mosquitto_sub&amp;quot; and &amp;quot;mosquitto_pub&amp;quot; tools, and they worked ok with the given psk, the same that I used in the example.&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Jos&amp;eacute; Forno&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT - issue with Connect ACK</title><link>https://devzone.nordicsemi.com/thread/251665?ContentTypeID=1</link><pubDate>Tue, 26 May 2020 09:57:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e68c77cd-d4c9-4a78-981a-60ac6496d510</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Are you following a guide or something?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]the broker send a &amp;quot;Connect Ack&amp;quot; but the publisher client example halts for some reason and it doesn&amp;#39;t generate the MQTT_EVT_CONNACK event.[/quote]
&lt;p&gt;Why does it do this? Can you debug and find out where the MQTT_EVT_CONNACK should be generated. Perhaps it will tell you why the MQTT_EVT_CONNACK isn&amp;#39;t generated?&lt;/p&gt;
&lt;p&gt;Please check the&amp;nbsp;mqtt_handle_packet() in mqtt_rx.c.&lt;/p&gt;
&lt;p&gt;What is&amp;nbsp;&lt;/p&gt;
&lt;p&gt;evt.result = evt.param.connack.return_code if this handler is called?&lt;/p&gt;
&lt;p&gt;If this event is not generated, why is that?&lt;/p&gt;
&lt;p&gt;Do you get any other events in mqtt_handle_packet() at the time you would expect the MQTT_EVT_CONNACK event?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;The addresses that you have sensored from the screenshot, are they all the same? Is the RPi using the correct address?&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>