<?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>Connecting to Private MQTT broker</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/96600/connecting-to-private-mqtt-broker</link><description>Dear Nordic Team, 
 I am currently using nrf9160 for MQTT transmission. I have successfully connected to a public MQTT broker which is HiveMQ and transmitted data to HiveMQ. The next step I am trying to achieve is to transfer data to a private MQTT broker</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 23 Feb 2023 07:43:32 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/96600/connecting-to-private-mqtt-broker" /><item><title>RE: Connecting to Private MQTT broker</title><link>https://devzone.nordicsemi.com/thread/411536?ContentTypeID=1</link><pubDate>Thu, 23 Feb 2023 07:43:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:209a5593-2682-426f-8438-60e20306c92b</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;What happens on the broker side? Does this receive the published message?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Connecting to Private MQTT broker</title><link>https://devzone.nordicsemi.com/thread/411528?ContentTypeID=1</link><pubDate>Thu, 23 Feb 2023 06:54:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ee05b4c-12ce-4809-aff4-a249fe539eeb</guid><dc:creator>yeo</dc:creator><description>&lt;p&gt;But if the mqtt broker receives the message it will show that messages are received. There are no messages received output in the terminal.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Yeo Rhi Khin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Connecting to Private MQTT broker</title><link>https://devzone.nordicsemi.com/thread/411260?ContentTypeID=1</link><pubDate>Wed, 22 Feb 2023 08:08:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e2dc9a4d-dfa8-4cc1-9559-6f8db068a067</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;The sample works&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1677053331816v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Connecting to Private MQTT broker</title><link>https://devzone.nordicsemi.com/thread/411252?ContentTypeID=1</link><pubDate>Wed, 22 Feb 2023 07:54:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5cd26d5-efca-4c56-9061-28aa3b5553b5</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Do you have any log output to share as well? Do you receive any errors?&amp;nbsp; Difficult to tell what is failing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Connecting to Private MQTT broker</title><link>https://devzone.nordicsemi.com/thread/411244?ContentTypeID=1</link><pubDate>Wed, 22 Feb 2023 06:57:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1975e569-602e-4fc9-b9a2-0c3358be25e8</guid><dc:creator>yeo</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/MQTT_5F00_simple-_2800_3_2900_.zip"&gt;devzone.nordicsemi.com/.../MQTT_5F00_simple-_2800_3_2900_.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This is my modified code. However, it still doesn&amp;#39;t send messages to the private MQTT broker. Can you please help me to have a look?&lt;/p&gt;
&lt;p&gt;best regards,&lt;/p&gt;
&lt;p&gt;Yeo Rhi Khin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Connecting to Private MQTT broker</title><link>https://devzone.nordicsemi.com/thread/410859?ContentTypeID=1</link><pubDate>Mon, 20 Feb 2023 12:03:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6e1fdfcc-58d8-4133-b672-29a0774d61ee</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Hello,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Looking at the last project that you have attached, there is no username or password added to client_init().&lt;br /&gt;&lt;br /&gt;Both are configured to NULL.&lt;/p&gt;
&lt;p&gt;Have a look at the sample&amp;nbsp;&lt;em&gt;zephyr\samples\net\cloud\mqtt_azure. &lt;/em&gt;I.e. this shows how to configure the username and password. The sample uses KConfig to define the Kconfig&amp;nbsp;symbols which you can add value to in prj.conf. In client_init() the following is added:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;//add to top off client_init()
static struct mqtt_utf8 password;
static struct mqtt_utf8 username;


client-&amp;gt;client_id.utf8 = (uint8_t *)MQTT_CLIENTID;
client-&amp;gt;client_id.size = strlen(MQTT_CLIENTID);

password.utf8 = (uint8_t *)CONFIG_SAMPLE_CLOUD_AZURE_PASSWORD;
password.size = strlen(CONFIG_SAMPLE_CLOUD_AZURE_PASSWORD);

client-&amp;gt;password = &amp;amp;password;

username.utf8 = (uint8_t *)CONFIG_SAMPLE_CLOUD_AZURE_USERNAME;
username.size = strlen(CONFIG_SAMPLE_CLOUD_AZURE_USERNAME);

client-&amp;gt;user_name = &amp;amp;username;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This can be used as an example to get your project up and running.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Connecting to Private MQTT broker</title><link>https://devzone.nordicsemi.com/thread/410755?ContentTypeID=1</link><pubDate>Sun, 19 Feb 2023 08:35:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e31c2063-c2fb-4606-9c32-5cefe3e842b4</guid><dc:creator>yeo</dc:creator><description>&lt;p&gt;Hi, is there anyone to answer my question?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Connecting to Private MQTT broker</title><link>https://devzone.nordicsemi.com/thread/410151?ContentTypeID=1</link><pubDate>Wed, 15 Feb 2023 16:02:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2361557b-e9bb-47fd-8707-c57ebd0ccd28</guid><dc:creator>yeo</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/8816.mqtt_5F00_simple_5F00_sensor-_2800_2_2900_.zip"&gt;devzone.nordicsemi.com/.../8816.mqtt_5F00_simple_5F00_sensor-_2800_2_2900_.zip&lt;/a&gt;Hi, Please refer to this file instead&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Connecting to Private MQTT broker</title><link>https://devzone.nordicsemi.com/thread/410149?ContentTypeID=1</link><pubDate>Wed, 15 Feb 2023 15:58:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:838fe691-3de7-424c-963f-14d86732cbef</guid><dc:creator>yeo</dc:creator><description>&lt;p&gt;Hi, sorry for the late reply. I have modified my code in client_init(), prj.conf, and Kconfig. However, I still couldn&amp;#39;t send the data data to private MQTT broker. I have attached the code below.&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/8741.MQTT_5F00_simple.zip"&gt;devzone.nordicsemi.com/.../8741.MQTT_5F00_simple.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Connecting to Private MQTT broker</title><link>https://devzone.nordicsemi.com/thread/409536?ContentTypeID=1</link><pubDate>Mon, 13 Feb 2023 10:21:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0934e51-ec94-48c4-9344-c6d1c4e6bcc8</guid><dc:creator>&amp;#216;yvind</dc:creator><description>&lt;p&gt;Hello,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;You will need to know if the MQTT broker uses TLS for private connection. If so, you can build your project using &lt;em&gt;nrf\samples\nrf9160\mqtt_simple\overlay-tls.conf.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;If you are using the simple_mqtt sample, you can&amp;nbsp;add the user_name and password in client_init(). From&amp;nbsp;zephyr\include\zephyr\net\mqtt.h&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;	/** User name (if any) to be used for the connection. NULL indicates
	 *  no user name.
	 */
	struct mqtt_utf8 *user_name;

	/** Password (if any) to be used for the connection. Note that if
	 *  password is provided, user name shall also be provided. NULL
	 *  indicates no password.
	 */
	struct mqtt_utf8 *password;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;More information can be found in the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.2.0/zephyr/connectivity/networking/api/mqtt.html#mqtt"&gt;MQTT library documentation&lt;/a&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>