# mqttClient-for-Legato with mosquitto setup?

**URL:** <https://forum.legato.io/t/mqttclient-for-legato-with-mosquitto-setup/5186>\
**Category:** Uncategorized\
**Created:** [May 6, 2020, 7:24pm UTC](https://forum.legato.io/t/mqttclient-for-legato-with-mosquitto-setup/5186 "2020-05-06T19:24:27Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![piinst](https://avatars.discourse-cdn.com/v4/letter/p/919ad9/32.png) [@piinst](https://forum.legato.io/u/piinst)\
**Post date:** [May 6, 2020, 7:24pm UTC](https://forum.legato.io/t/mqttclient-for-legato-with-mosquitto-setup/5186/1 "2020-05-06T19:24:27Z")

</div>

I am trying to get [mqttClient-for-Legato](https://github.com/nhonchu/mqttClient-for-Legato) on a WP7700 / mangOH Red talking to a mosquitto server running on an Ubuntu host.

I have used **mqtt config set** to set the host IP in the config to 192.168.2.3 and port to 1883 (used by mosquitto), then enter **mqtt session start** , however it doesn’t seem to be attempting to connect. On the other hand I can connect using **nc 192.168.2.3 1883** on the WP7700, mosquitto reports the new connection on the Ubuntu side.

Has anyone made this work?

---

<div class="post-metadata">

**Author:** ![piinst](https://avatars.discourse-cdn.com/v4/letter/p/919ad9/32.png) [@piinst](https://forum.legato.io/u/piinst)\
**Post date:** [May 11, 2020, 2:58pm UTC](https://forum.legato.io/t/mqttclient-for-legato-with-mosquitto-setup/5186/2 "2020-05-11T14:58:26Z")

</div>

It appears that the le\_data routines do not work over the ECM interface with the host. Marked solved to close the question. Looks similar to this problem:

> [@Airvantage through Ethernet](https://forum.legato.io/t/airvantage-through-ethernet/5187):
>
> Hello David Frey posted this in the mangoh forum November 2017: I talked to a couple people on the Legato team and they mentioned that the reason you cannot connect to AirVantage using the ethernet connection on the mangOH Green is that the ethernet connection isn’t supported by the data connection service. The data connection service is responsible for establishing a data connection to the internet on demand. This is a known issue and there is some interest internally in improving the data c…

---

<div class="post-metadata">

**Author:** ![Kalai](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/kalai/32/1135_2.png) [@Kalai](https://forum.legato.io/u/Kalai)\
**Post date:** [February 23, 2021, 6:37pm UTC](https://forum.legato.io/t/mqttclient-for-legato-with-mosquitto-setup/5186/3 "2021-02-23T18:37:51Z")

</div>

can i have the sample code how to work in mosquitto mqqt , Since am new to this platform i would like to know basic step how to publish and subscribe through mosquitto mqtt  
Provide Interface binding in the code

---

<div class="post-metadata">

**Author:** ![piinst](https://avatars.discourse-cdn.com/v4/letter/p/919ad9/32.png) [@piinst](https://forum.legato.io/u/piinst)\
**Post date:** [February 23, 2021, 7:55pm UTC](https://forum.legato.io/t/mqttclient-for-legato-with-mosquitto-setup/5186/4 "2021-02-23T19:55:41Z")

</div>

I ended up using the Paho MQTT library which has a straightforward interface and works with any internet connection. You can use the sample programs as a model.

[https://www.eclipse.org/paho/](https://www.eclipse.org/paho/)

---

<div class="post-metadata">

**Author:** ![ga.imparato](https://avatars.discourse-cdn.com/v4/letter/g/c89c15/32.png) [@ga.imparato](https://forum.legato.io/u/ga.imparato)\
**Post date:** [April 7, 2021, 2:02pm UTC](https://forum.legato.io/t/mqttclient-for-legato-with-mosquitto-setup/5186/5 "2021-04-07T14:02:53Z")

</div>

Hi @piinst, sorry fot the answer: where is mqtt config set? And how do you enter in the mqtt session start? In the app start? I have the following folder in the mangOH project and I’ave already installed mosquitto on ubuntu:

 ![image](https://us1.discourse-cdn.com/flex019/uploads/legato1/original/2X/f/f267b94ade3738b48d78beb948cca61d6a4305a0.png)

---

<div class="post-metadata">

**Author:** ![piinst](https://avatars.discourse-cdn.com/v4/letter/p/919ad9/32.png) [@piinst](https://forum.legato.io/u/piinst)\
**Post date:** [April 7, 2021, 2:19pm UTC](https://forum.legato.io/t/mqttclient-for-legato-with-mosquitto-setup/5186/6 "2021-04-07T14:19:09Z")

</div>

Hi, I am not using the MqttClient app. The paho MQTT library which I use resides inside my main application and has its own api.

---

<div class="post-metadata">

**Author:** ![ga.imparato](https://avatars.discourse-cdn.com/v4/letter/g/c89c15/32.png) [@ga.imparato](https://forum.legato.io/u/ga.imparato)\
**Post date:** [April 7, 2021, 2:27pm UTC](https://forum.legato.io/t/mqttclient-for-legato-with-mosquitto-setup/5186/7 "2021-04-07T14:27:59Z")

</div>

I didn’t understand how to build it. Did you follow this guide?

> **[GitHub - nhonchu/mqttClient-for-Legato: mqttClient application for Legato...](https://github.com/nhonchu/mqttClient-for-Legato#building-and-installing-applications)**
>
> mqttClient application for Legato framework. Contribute to nhonchu/mqttClient-for-Legato development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![piinst](https://avatars.discourse-cdn.com/v4/letter/p/919ad9/32.png) [@piinst](https://forum.legato.io/u/piinst)\
**Post date:** [April 7, 2021, 2:45pm UTC](https://forum.legato.io/t/mqttclient-for-legato-with-mosquitto-setup/5186/8 "2021-04-07T14:45:18Z")

</div>

Not using that app. I am using the paho MQTT library as downloaded from [eclipse.org](http://eclipse.org).

---

<div class="post-metadata">

**Author:** ![ga.imparato](https://avatars.discourse-cdn.com/v4/letter/g/c89c15/32.png) [@ga.imparato](https://forum.legato.io/u/ga.imparato)\
**Post date:** [April 7, 2021, 3:09pm UTC](https://forum.legato.io/t/mqttclient-for-legato-with-mosquitto-setup/5186/9 "2021-04-07T15:09:23Z")

</div>

ah ok I understand: paho is another way for the client side. Do you think is simpliest to use mqttClient folder or paho? (As broker I want to use Mosquitto)
