---
title: MQTT
project: Flow
version: 11.1
section: components
language: en
license: MIT
url: https://totaljs.es/docs/flow/11-1/components/mqtt/
updated: 2026-11-20T06:50:57.962Z
---

# MQTT

> Components that connect to an MQTT broker, publish and subscribe.

Components that connect to an MQTT broker, publish and subscribe. This page holds the catalogue group **MQTT**.

Each entry lists the inputs and outputs of the component, its main settings and the text of its readme. To add a component to a FlowStream, see [Download components](/flow/11-1/guides/download-components/).

## API

### mqtt-broker.html · version 4

Type: `component`

Connects to an MQTT broker and sends the messages it receives.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `host` | `String` | no | `localhost` | Hostname or IP address. |
| `port` | `Number` | no | `1883` | Port. |
| `secure` | `Boolean` | no | `false` | Secure (SSL). |
| `clientid` | `String` | no |  | Client ID. |
| `auth` | `String` | no |  | Require Authorization. |
| `username` | `String` | no |  | Username. |
| `password` | `String` | no |  | Password. |
| `lwt` | `String` | no |  | Last will topic (LWT). |
| `lwttopic` | `String` | no |  | Last will topic. |
| `lwtmessage` | `String` | no |  | Last will message. |

**Inputs:** none.  
**Outputs:** `output` (Messages).

Flow installs the npm package `mqtt` when you add the component.

### mqtt-publish.html · version 3

Type: `component`

Publishes messages to an MQTT topic.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `broker` | `String` | no |  | Broker. |

**Inputs:** `message` (Message).  
**Outputs:** none.

MQTT Publish

Input:

```javascript
{
	topic: 'some/topic',
	message: { some: 'data' },
	// optional
	options: {
		qos: 0|1|2,
		retain: true|false
	}
}
```

### mqtt-subscribe.html · version 3

Type: `component`

Subscribes to an MQTT topic.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `broker` | `String` | no |  | Broker. |
| `topic` | `String` | no |  | Topic. |

**Inputs:** none.  
**Outputs:** `message` (Message).

MQTT Subscribe
