# MQTT for Clarion

**URL:** <https://clarionhub.com/t/mqtt-for-clarion/6883>\
**Category:** questions\
**Tags:** network\
**Created:** [December 29, 2023, 12:28pm UTC](https://clarionhub.com/t/mqtt-for-clarion/6883 "2023-12-29T12:28:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thys](https://clarionhub.com/user_avatar/clarionhub.com/thys/32/3399_2.png) [@Thys](https://clarionhub.com/u/Thys)\
**Post date:** [December 29, 2023, 12:28pm UTC](https://clarionhub.com/t/mqtt-for-clarion/6883/1 "2023-12-29T12:28:51Z")

</div>

I have a client that needs our app to communicate to their field units via MQTT. Has anyone dealt with MQTT from Clarion before?

Thanks  
Matthys

---

<div class="post-metadata">

**Author:** ![Mike\_Duglas](https://clarionhub.com/user_avatar/clarionhub.com/mike_duglas/32/1061_2.png) [@Mike\_Duglas](https://clarionhub.com/u/Mike_Duglas)\
**Post date:** [December 29, 2023, 1:49pm UTC](https://clarionhub.com/t/mqtt-for-clarion/6883/2 "2023-12-29T13:49:00Z")

</div>

libcurl supports mqtt protocol.

---

<div class="post-metadata">

**Author:** ![Thys](https://clarionhub.com/user_avatar/clarionhub.com/thys/32/3399_2.png) [@Thys](https://clarionhub.com/u/Thys)\
**Post date:** [December 29, 2023, 2:08pm UTC](https://clarionhub.com/t/mqtt-for-clarion/6883/3 "2023-12-29T14:08:48Z")

</div>

Thanks Mike, I didn’t know that libcurl supports it. I’ll look at your _libcurl_ repo on GitHub to see how it can be done.

---

<div class="post-metadata">

**Author:** ![Mike\_Duglas](https://clarionhub.com/user_avatar/clarionhub.com/mike_duglas/32/1061_2.png) [@Mike\_Duglas](https://clarionhub.com/u/Mike_Duglas)\
**Post date:** [December 29, 2023, 3:16pm UTC](https://clarionhub.com/t/mqtt-for-clarion/6883/4 "2023-12-29T15:16:58Z")

</div>

# MQTT in curl

## Usage

A plain “GET” subscribes to the topic and prints all published messages.  
Doing a “POST” publishes the post data to the topic and exits.

Example subscribe:

```
curl mqtt://host.home/bedroom/temp

```

Example publish:

```
curl -d 75 mqtt://host.home/bedroom/dimmer

```

## What does curl deliver as a response to a subscribe

It outputs two bytes topic length (MSB | LSB), the topic followed by the  
payload.

## Caveats

Remaining limitations:

- Only QoS level 0 is implemented for publish
- No way to set retain flag for publish
- No TLS (mqtts) support
- Naive EAGAIN handling will not handle split messages

---

<div class="post-metadata">

**Author:** ![Gustavo\_Saracca](https://clarionhub.com/user_avatar/clarionhub.com/gustavo_saracca/32/5355_2.png) [@Gustavo\_Saracca](https://clarionhub.com/u/Gustavo_Saracca)\
**Post date:** [September 24, 2024, 12:21am UTC](https://clarionhub.com/t/mqtt-for-clarion/6883/5 "2024-09-24T00:21:14Z")

</div>

Hi Mike,

Can a call to LibCurl work inside a IDLE() hook procedure ?

---

<div class="post-metadata">

**Author:** ![Mike\_Duglas](https://clarionhub.com/user_avatar/clarionhub.com/mike_duglas/32/1061_2.png) [@Mike\_Duglas](https://clarionhub.com/u/Mike_Duglas)\
**Post date:** [September 24, 2024, 1:36pm UTC](https://clarionhub.com/t/mqtt-for-clarion/6883/6 "2024-09-24T13:36:05Z")

</div>

I never tried that, I’m sure you are able to check it yourself.

---

<div class="post-metadata">

**Author:** ![AbdullahAkilah](https://clarionhub.com/user_avatar/clarionhub.com/abdullahakilah/32/4818_2.png) [@AbdullahAkilah](https://clarionhub.com/u/AbdullahAkilah)\
**Post date:** [September 24, 2024, 1:46pm UTC](https://clarionhub.com/t/mqtt-for-clarion/6883/7 "2024-09-24T13:46:37Z")

</div>

I’ve used the Mosquitto libraries in C6

> **[Eclipse Mosquitto](https://mosquitto.org/)**
>
> Eclipse Mosquitto is an open source (EPL/EDL licensed) message broker that
> implements the MQTT protocol versions 5.0, 3.1.1 and 3.1. Mosquitto
> is lightweight and is suitable for use
