Re: How to receive published data using MQTT subscriber?
I’m afraid we don’t have an out-of-the box example for the MQTT subscriber in the Zephyr tree. However the aforementioned “mqtt_pubsub” test is a good reference on how to handle subscribtions. There are basically three things to do in order to receive data for a particular topic:
You can also check the Nordic MQTT sample as a reference (https://github.com/nrfconnect/sdk-nrf/blob/master/samples/nrf9160/mqtt_simple/src/main.c), note however this example is nRF91 specific and contains some other stuff unrelated to MQTT per se.
From: devel@... <devel@...> On Behalf Of Brenton Chetty via lists.zephyrproject.org
Sent: wtorek, 3 sierpnia 2021 21:02
Subject: [Zephyr-devel] How to receive published data using MQTT subscriber?
Hi devel team
May you please assist me with this issue.
I managed to use the "mqtt_publisher" example in the sample folder, as well as the "mqtt_pubsub" and "mqtt_subscriber" in "zephyr/tests/net/lib".
From the subscriber examples I could not find code to receive messages which are published to the subscribed topic.
- Is there any example code available for receiving the messages from the subscribed topic?
- If not, how do you suggest I proceed?