# Mqtt client example for br plc, link to sample

**URL:** <https://community.br-automation.com/t/mqtt-client-example-for-br-plc-link-to-sample/7302>\
**Category:** B&R Software & Runtime\
**Tags:** modbus\
**Created:** [June 13, 2025, 11:09am UTC](https://community.br-automation.com/t/mqtt-client-example-for-br-plc-link-to-sample/7302 "2025-06-13T11:09:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dmitri\_k](https://avatars.discourse-cdn.com/v4/letter/d/FF8800/32.png) [@Dmitri\_k](https://community.br-automation.com/u/Dmitri_k)\
**Post date:** [June 13, 2025, 11:09am UTC](https://community.br-automation.com/t/mqtt-client-example-for-br-plc-link-to-sample/7302/1 "2025-06-13T11:09:53Z")

</div>

Hi Wenjie Cui!  
I want to implement communication between B&R PLC (client) and MQTT broker, but the library paho.mqtt.c-ar you mentioned is not available. Could you please share an example program to send messages to MQTT broker using this library?

---

<div class="post-metadata">

**Author:** ![tommi.piiparinen](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/tommi.piiparinen/32/2183_2.png) [@tommi.piiparinen](https://community.br-automation.com/u/tommi.piiparinen)\
**Post date:** [June 13, 2025, 11:22am UTC](https://community.br-automation.com/t/mqtt-client-example-for-br-plc-link-to-sample/7302/2 "2025-06-13T11:22:43Z")

</div>

The library is available in the archive:

> **[GitHub - archive-br-automation-com/paho.mqtt.c-ar: MQTT Client for Automation Runtime based on...](https://github.com/archive-br-automation-com/paho.mqtt.c-ar)**
>
> MQTT Client for Automation Runtime based on eclipse/paho.mqtt.c

Please see this post for more info:

> [@Github not showing any repositories](https://community.br-automation.com/t/github-not-showing-any-repositories/6794):
>
> As some may have noticed our [Github](https://github.com/br-automation-com) is not showing any public repositories. We had a migration of our Github instance, this caused that no public repos are shown today. The public state should be corrected at the end of May. Apologies for the inconvenience.

---

<div class="post-metadata">

**Author:** ![Dmitri\_k](https://avatars.discourse-cdn.com/v4/letter/d/FF8800/32.png) [@Dmitri\_k](https://community.br-automation.com/u/Dmitri_k)\
**Post date:** [June 13, 2025, 1:39pm UTC](https://community.br-automation.com/t/mqtt-client-example-for-br-plc-link-to-sample/7302/3 "2025-06-13T13:39:17Z")

</div>

Thank you so much!  
This is exactly what I was looking for! Very useful!

---

<div class="post-metadata">

**Author:** ![shrenikec](https://avatars.discourse-cdn.com/v4/letter/s/FF8800/32.png) [@shrenikec](https://community.br-automation.com/u/shrenikec)\
**Post date:** [April 29, 2026, 5:33pm UTC](https://community.br-automation.com/t/mqtt-client-example-for-br-plc-link-to-sample/7302/4 "2026-04-29T17:33:49Z")

</div>

Dear All,  
As I have tried to used this library in my project but not able to connect with my cloud. It is showing an error of -10005.  
So anybody can help how to resolve this issue.

Thanks In Advance.  
Shrenik

---

<div class="post-metadata">

**Author:** ![alexander.hefner](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/alexander.hefner/32/111_2.png) [@alexander.hefner](https://community.br-automation.com/u/alexander.hefner)\
**Post date:** [April 29, 2026, 5:56pm UTC](https://community.br-automation.com/t/mqtt-client-example-for-br-plc-link-to-sample/7302/5 "2026-04-29T17:56:44Z")

</div>

Hi,

i’ve no experience with that library, but having a look into the constants definition I see that error -10005 means “connection failed”.  
So I would recommend to check your PLCs IP settings, if the broker is reachable.  
Especially check, if DNS is activated (if using a hostname), if the default gateway settings are correct (if the broker isn’t on the same subnet as the PLC), and so on.  
Additionally, please check the PLC loggers for information (I’m not sure, but I could imagine that this library creates some logger entries / an own logger module).

The’re some hints / informations about the network settings in the github documentation:

> **[GitHub - br-automation-community/paho.mqtt.c-ar: MQTT Client for Automation...](https://github.com/br-automation-community/paho.mqtt.c-ar/tree/master)**
>
> MQTT Client for Automation Runtime based on eclipse/paho.mqtt.c - br-automation-community/paho.mqtt.c-ar

Best regards!

---

<div class="post-metadata">

**Author:** ![job.franken](https://avatars.discourse-cdn.com/v4/letter/j/FF8800/32.png) [@job.franken](https://community.br-automation.com/u/job.franken)\
**Post date:** [April 30, 2026, 6:55am UTC](https://community.br-automation.com/t/mqtt-client-example-for-br-plc-link-to-sample/7302/6 "2026-04-30T06:55:43Z")

</div>

Please note that if you are using the certificate store you could hit a bug in the AS6/AR6 of the library. [AS6/AR6: Own Certificates aren’t loading when placed in the certificates store · Issue #41 · br-automation-community/paho.mqtt.c-ar](https://github.com/br-automation-community/paho.mqtt.c-ar/issues/41). You can use the workaround of placing the certificates in the USER filedevice.
