examples/mqttc: add subscriber client implementation example#3618
Conversation
|
Nice work @dmihai03 I noticed there was already a Mixed case identifier in the original code, please add MQTTErrors to g_white_prefix at nuttx/tools/nxstyle.c to fix this Mixed case error. Some suggestion to improve to original code too: move the certificate string to a separated cert.inc and just add |
|
Thank you @acassis! |
Yes, please! Later I will fix these too: |
|
Very nice, big thank you @dmihai03 and thank your for very good PR description with testing!! :-) CI check still complains about these, please take a look :-) |
For these errors I've opened a PR where I added MQTTErrors into the nxstyle.c. |
|
@xiaoxiang781216 PTAL, his patch to nxstyle is already on mainline |
|
c07a1fa to
4f02ba5
Compare
|
@dmihai03 please rebase to the last master which fix the ci build error. |
512e1e3 to
ac2c4b7
Compare
|
@dmihai03 please fix the build break: |
Implement the subscriber client that optionally integrates
the TLS layer and can reconnect to the broker if the
application is running in unstable network environments.
The client is compliant with all 3 levels of QoS.
Signed-off-by: Mihai Pacuraru <mpacuraru@protonmail.com>
Summary
This PR adds a MQTT-C subscriber client example to examples/mqttc, alongside the existing publisher, and makes it robust enough to run on a real (Wi-Fi) target.
The subscriber (mqttc_sub) is built as a separate program, selectable independently from the publisher. Beyond the basic subscribe loop, the change addresses several issues found when running on NuttX hardware:
Impact
Testing
Host:
Target:
Steps:
Broker logs when subscribing:
Reconnect ping sent once in 5 minutes:
Broker forwarding QoS 2 message:
Heap usage:
Flash memory usage (total image size):