<?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 Example - Settings for publishing while subscribing?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/15057/mqtt-example---settings-for-publishing-while-subscribing</link><description>Hi, I use the following. 
 
 Raspberry Pi 3 (RPi3 with Raspbian Jessie 4.4) as a router, 
 
 RPi3 is connected to a Wi-Fi router to access the Internet by using the built-in Wi-Fi BLE BCM43438 chip. 
 
 
 IoT SDK 0.9 
 
 
 MQTT Publisher Example</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 20 Apr 2017 12:16:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/15057/mqtt-example---settings-for-publishing-while-subscribing" /><item><title>RE: MQTT Example - Settings for publishing while subscribing?</title><link>https://devzone.nordicsemi.com/thread/57478?ContentTypeID=1</link><pubDate>Thu, 20 Apr 2017 12:16:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:24230356-9407-4f3a-b428-dd655bf6ad8f</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;Please start a new thread, and link to this one.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT Example - Settings for publishing while subscribing?</title><link>https://devzone.nordicsemi.com/thread/57477?ContentTypeID=1</link><pubDate>Thu, 20 Apr 2017 11:54:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4104cb17-672d-4bab-83d8-6c41f478ebf9</guid><dc:creator>g.joshi</dc:creator><description>&lt;p&gt;Hey copied the code min main file but i have few issues:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;In step 3 when i push button 2 LED 4 blinks instead of no activity.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In step 4 when i push button 4 it doesn´t subscribe and LD3 is off all the while.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I can add the code if want.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT Example - Settings for publishing while subscribing?</title><link>https://devzone.nordicsemi.com/thread/57476?ContentTypeID=1</link><pubDate>Wed, 19 Apr 2017 15:11:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95ca6761-6af3-43c9-b275-bc09f9d6528d</guid><dc:creator>g.joshi</dc:creator><description>&lt;p&gt;Hey copied the code min main file but i have few issues:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;In step 3 when i push button 2 LED 4 blinks instead of no activity.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In step 4 when i push button 4 it doesn´t subscribe and LD3 is off all the while.  I can add the code if want.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT Example - Settings for publishing while subscribing?</title><link>https://devzone.nordicsemi.com/thread/57475?ContentTypeID=1</link><pubDate>Mon, 29 Aug 2016 12:49:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf3c34aa-b6a5-402f-95c0-df06aa04986f</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I made an example for both publishing and subscribing in the same example. It is based on mqtt publisher example and merged with the mqtt subscriber example. I added button 4 as the subscribing button, and LED 4 is toggling only if it receives a publish message from the broker.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;LED1 lights up after connection&lt;/li&gt;
&lt;li&gt;Push Button1 to connect to broker. LED2 turns on.&lt;/li&gt;
&lt;li&gt;Push Button2 to publish. No activity on LEDs&lt;/li&gt;
&lt;li&gt;Push Button4 to subscribe. LED3 turns on.&lt;/li&gt;
&lt;li&gt;Push Button2 to publish. You should now see activity on LED4. This means that the kit is both publishing and subscribing to the same topic &amp;quot;led/state&amp;quot;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Replace the content of the main.c file in the mqtt publisher example with this one: &lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/main_5F00_mqtt_5F00_pub_5F00_sub.c"&gt;main.c&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT Example - Settings for publishing while subscribing?</title><link>https://devzone.nordicsemi.com/thread/57474?ContentTypeID=1</link><pubDate>Wed, 10 Aug 2016 14:31:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe73cfc8-5611-456a-9b00-a2cccbfb0ee6</guid><dc:creator>MANGO</dc:creator><description>&lt;p&gt;Well, I tested both the standalone subscriber project and standalone publisher project.&lt;/p&gt;
&lt;p&gt;The standalone subscriber project triggered the breakpoint at &lt;code&gt;case MQTT_EVT_PUBLISH:&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;However, my merged project does not.&lt;/p&gt;
&lt;p&gt;Then how about using &amp;quot;diff&amp;quot;? Can you upload the merged application, the main.c file?&lt;/p&gt;
&lt;p&gt;Then I can &amp;quot;diff&amp;quot; (compare codes) together and check the problem.&lt;/p&gt;
&lt;p&gt;-Best Regards, Mango&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT Example - Settings for publishing while subscribing?</title><link>https://devzone.nordicsemi.com/thread/57473?ContentTypeID=1</link><pubDate>Tue, 09 Aug 2016 10:27:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:270940a2-6ec1-4145-b953-f4ed3bc1f686</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;If you first try the subscriber and publisher examples separately, and test them like described in &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.iotsdk.v0.9.0%2Fiot_sdk_app_mqtt_subscriber.html&amp;amp;cp=6_1_0_5_6_1_2&amp;amp;anchor=iot_sdk_app_mqtt_subscriber_test"&gt;the documentation&lt;/a&gt;, and know that they work, then you know that the setup is correct and it will be easier to debug the subscriber&amp;amp;publisher project.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT Example - Settings for publishing while subscribing?</title><link>https://devzone.nordicsemi.com/thread/57472?ContentTypeID=1</link><pubDate>Tue, 09 Aug 2016 09:01:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de5dda51-a6eb-4322-92e4-71b29cb7ca8b</guid><dc:creator>MANGO</dc:creator><description>&lt;p&gt;Hi, Kristin.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;I haven&amp;#39;t tried the standalone subscriber project. I will do it soon.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;About the &amp;quot;Just to double check, the publisher is publishing on the topic &amp;quot;led/state&amp;quot;?&amp;quot; and &amp;quot;The publisher that is publishing on &amp;quot;led/state&amp;quot;, does it have the same broker port? &amp;quot;1883&amp;quot; for non-secure port, for instance?&amp;quot; ,&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;yes, it is.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The merged application (publish + subscribe) is both using port 1883.&lt;/p&gt;
&lt;p&gt;Thanks to Stian&amp;#39;s help, the Raspberry Pi (RPi) is using the 6tunnel to forward packets to IPv4.&lt;/p&gt;
&lt;p&gt;The application is publishing to topic &amp;quot;led/state&amp;quot;.&lt;/p&gt;
&lt;p&gt;Come to think of it, the application subscribed to the same topic.&lt;/p&gt;
&lt;p&gt;So I thought &lt;code&gt;MQTT_EVT_PUBLISH&lt;/code&gt; event will be triggered after publishing.&lt;/p&gt;
&lt;p&gt;While trying the standalone subscriber project, are you recommending me to subscribe to a different topic?&lt;/p&gt;
&lt;p&gt;For instance, publish to &amp;quot;led/state&amp;quot; but subscribe to &amp;quot;test&amp;quot;.&lt;/p&gt;
&lt;p&gt;Should I try it this way and see how it goes?&lt;/p&gt;
&lt;p&gt;-Best Regards, Mango&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT Example - Settings for publishing while subscribing?</title><link>https://devzone.nordicsemi.com/thread/57471?ContentTypeID=1</link><pubDate>Tue, 09 Aug 2016 08:35:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:968ebbff-70f1-4700-8bcd-2275c9c6884b</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;Does your subscriber code works in a standalone subscriber project?&lt;/p&gt;
&lt;p&gt;Just to double check, the publisher is publishing on the topic &amp;quot;led/state&amp;quot;?&lt;/p&gt;
&lt;p&gt;Does the publisher in you subscriber&amp;amp;publisher project work?&lt;/p&gt;
&lt;p&gt;The publisher that is publishing on &amp;quot;led/state&amp;quot;, does it have the same broker port? &amp;quot;1883&amp;quot; for non secure port, for instance?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT Example - Settings for publishing while subscribing?</title><link>https://devzone.nordicsemi.com/thread/57468?ContentTypeID=1</link><pubDate>Thu, 04 Aug 2016 12:04:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a0ee134c-1d39-4408-a81f-42d3ebc57b6a</guid><dc:creator>MANGO</dc:creator><description>&lt;p&gt;Well, I added the code by referring the subscriber example.&lt;/p&gt;
&lt;p&gt;However, even though the error code is 0 when calling &lt;code&gt;mqtt_subscribe&lt;/code&gt;,&lt;/p&gt;
&lt;p&gt;the breakpoint didn&amp;#39;t hit the &lt;code&gt;case MQTT_EVT_PUBLISH:&lt;/code&gt; when I publish data to the topic &amp;quot;led/state&amp;quot;.&lt;/p&gt;
&lt;p&gt;What seems to be the problem?&lt;/p&gt;
&lt;p&gt;-Best Regards, Mango&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT Example - Settings for publishing while subscribing?</title><link>https://devzone.nordicsemi.com/thread/57470?ContentTypeID=1</link><pubDate>Mon, 01 Aug 2016 08:43:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e7a617c0-8519-49fc-bf94-5ec72a4b9de6</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;Yes, the IoT SDK supports subscribing to multiple topics.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT Example - Settings for publishing while subscribing?</title><link>https://devzone.nordicsemi.com/thread/57469?ContentTypeID=1</link><pubDate>Mon, 01 Aug 2016 08:34:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:23a8c49a-a47a-4e0e-9a80-fffc08121088</guid><dc:creator>MANGO</dc:creator><description>&lt;p&gt;Great, while trying your suggestion I have an additional question.&lt;/p&gt;
&lt;p&gt;Does the IoT SDK support subscribing MQTT multiple topics?&lt;/p&gt;
&lt;p&gt;I&amp;#39;m curious whether the handler can handle when the application subscribes topic &amp;quot;A&amp;quot;, &amp;quot;B&amp;quot;, and &amp;quot;C&amp;quot;.&lt;/p&gt;
&lt;p&gt;-Best Regards, Mango&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MQTT Example - Settings for publishing while subscribing?</title><link>https://devzone.nordicsemi.com/thread/57467?ContentTypeID=1</link><pubDate>Mon, 01 Aug 2016 08:25:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2317690e-f686-4d3f-a8d9-0d7933089387</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;Yes, it is possible to combine a MQTT publisher and subscriber in one application. In order to do so, the publisher and subscriber functionality has to be &amp;quot;merged&amp;quot; into one application.
The settings that you need to include in the publisher example are the subscriber specific settings like APP_MQTT_SUBSCRIPTION_PKT_ID and APP_MQTT_SUBSCRIPTION_TOPIC for instance.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>