Skip to main content

MQTT Transport

Connects to an MQTT broker as a client. Each publish is one message, so no codec is needed.

  • Broker URL: mqtt://host:1883, mqtts://host:8883 (TLS), ws:// or wss:// (MQTT over WebSocket). A bare host:port means mqtt://.
  • Subscribe Topics: one topic filter per line (+ and # wildcards work), all with the chosen QoS. They are subscribed again after every reconnect.
  • TLS: a CA certificate path for a private CA, plus client certificate and key paths if the broker requires mutual TLS.

Received messages carry the topic, QoS and retain flag in their metadata. Publish with the MQTT message input or mqtt_publish in Lua. To run a broker inside CycBox instead, use the MQTT Server transport.

An MQTT client connection to a local broker, subscribed to cycbox/commands.

Configuration reference​

Config IDmqtt_transport
Selected byapp_transport = "mqtt_transport"
PlatformsLinux, Windows, Android
LicenseFree

MQTT pub/sub messaging transport

Supported server address types:

  • mqtt://host:port - Standard MQTT connection (port 1883)
  • mqtts://host:port - MQTT over TLS connection (port 8883)
  • ws://host:port/path - MQTT over WebSocket (port 8083)
  • wss://host:port/path - MQTT over Secure WebSocket (port 8084)

Supports TLS encrypted connections, optionally providing CA certificate and client certificate for authentication.

Supports subscribing to multiple topics, separating the topic list with newlines. Subscribe QoS applies to all subscribed topics.

SettingKeyTypeDefaultNotes
Broker URLmqtt_transport_broker_urlText"mqtt://localhost:1883"Required
Client IDmqtt_transport_client_idTextdetected at runtimeRequired
Usernamemqtt_transport_usernameText""
Passwordmqtt_transport_passwordText""
Use TLS/SSLmqtt_transport_use_tlsBooleanfalse
CA Certificate Pathmqtt_transport_ca_pathFile path""Shown when Use TLS/SSL (mqtt_transport_use_tls) = true
Client Certificate Pathmqtt_transport_client_cert_pathFile path""Shown when Use TLS/SSL (mqtt_transport_use_tls) = true
Client Key Pathmqtt_transport_client_key_pathFile path""Shown when Use TLS/SSL (mqtt_transport_use_tls) = true
Subscribe Topicsmqtt_transport_subscribe_topicsMultiline text""
Subscribe QoSmqtt_transport_subscribe_qosInteger (with presets)1Required
HTTP/HTTPS Proxy URL (optional)mqtt_transport_proxy_urlText (with presets)""

Setting details​

Client ID​

The available values are detected on the machine running CycBox (attached devices, generated ids), so no fixed default or option list is shown here.

Subscribe QoS​

Presets (any other value can be entered):

ValueLabel
0QoS 0 (At most once)
1QoS 1 (At least once)
2QoS 2 (Exactly once)

HTTP/HTTPS Proxy URL (optional)​

Presets (any other value can be entered):

ValueLabel
""No proxy
"http://proxy.example.com:8080"HTTP
"http://user:pass@proxy.example.com:8080"HTTP with auth
"https://proxy.example.com:8443"HTTPS
"https://user:pass@proxy.example.com:8443"HTTPS with auth

Example config​

Default values as they appear in a saved configuration (for example the JSON block at the end of a cycbox/examples/*.lua file). Settings detected at runtime are omitted.

{
"app": {
"app_transport": "mqtt_transport"
},
"mqtt_transport": {
"mqtt_transport_broker_url": "mqtt://localhost:1883",
"mqtt_transport_username": "",
"mqtt_transport_password": "",
"mqtt_transport_use_tls": false,
"mqtt_transport_ca_path": "",
"mqtt_transport_client_cert_path": "",
"mqtt_transport_client_key_path": "",
"mqtt_transport_subscribe_topics": "",
"mqtt_transport_subscribe_qos": 1,
"mqtt_transport_proxy_url": ""
}
}