Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

MQTT Notification

Schemesmqtt://, mqtts://
Cargo featureservice-mqtt
Servicehttps://mqtt.org/
Body formatstext (first is the default)
Attachmentsno
Title lengthno title (merged into the body)
Body length268,435,455 characters
Body linesunlimited
Request throttle500 ms between requests
Vendor URLs acceptedno

URL formats

{schema}://{user}@{host}/{topic}
{schema}://{user}@{host}:{port}/{topic}
{schema}://{user}:{password}@{host}/{topic}
{schema}://{user}:{password}@{host}:{port}/{topic}

{schema} is one of mqtt://, mqtts://.

URL tokens

TokenMeaningTypeRequiredDefaultNotes
{host}Hostnamestringyes
{password}Passwordstringyessecret
{port}Portint, 1 to 65535no
{targets}Targetslistnoany of topic; separated by /
{topic}Target Queuestringyes
{user}User Namestringyes

Query parameters

ParameterMeaningTypeDefaultNotes
client_idClient IDstring
qosQOSint, 0 to 20
retainRetain Messagesboolno
sessionUse Sessionboolno
toTargetslistsets {targets}
versionVersionchoicev3.1.1one of v3.1.1, v3.1, v5.0

The common URL parameters (format, overflow, verify, redirect, cto, rto, retry, wait, store, tag, tz, user, password, port, optional, emojis) apply as well.

Examples

Accepted URLs (tokens are fake):

mqtt://user@localhost/t
mqtt://localhost/b%20a;c
mqtts://localhost:8884/t
mqtt://localhost/my/topic
mqtts://user:pass@localhost/my/topic
mqtt://localhost/my/topic,my/other/topic
mqtt://user:pass@localhost/a/b?qos=2
mqtt://user@localhost/my/topic?retain=yes

Rejected URLs:

mqtt://
mqtt://localhost?qos=123
mqtt://localhost/t?qos=-1
mqtt://localhost?qos=invalid

Send one from the command line:

mercurio -t 'Backup' -b 'Finished in 42s' 'mqtt://user@localhost/t'

Notes

MQTT (mqtt://, mqtts://): publishes the message to an MQTT broker.

The client is built in: MQTT 3.1 / 3.1.1 / 5, with CONNECT (client id, clean session, credentials, keepalive 30) answered by CONNACK, then one PUBLISH per topic (QoS 1 waits for PUBACK, QoS 2 runs PUBREC/PUBREL/PUBCOMP), then DISCONNECT.

Differences with Apprise

  • MQTT 5 works (Apprise passes clean_session to paho for every version, which paho rejects for v5).
  • TLS uses the bundled Mozilla roots or the SSL_CERT_FILE bundle (Apprise refuses verified mqtts:// without a CA bundle on disk).
  • Topics of one notification are not throttled against each other (Apprise waits 0.5 s between publishes).
  • CONNACK is awaited before publishing (paho publishes asynchronously).