Skip to main content

MQTT

MQTT (Message Queuing Telemetry Transport) is a lightweight protocol designed for real-time messaging using a publish/subscribe model. OIBus acts as an MQTT client using the MQTT.js library to interact with MQTT brokers.

Specific Settings​

Connection​

SettingDescriptionExample Value
URLAddress of the MQTT broker. Accepts mqtt://, mqtts://, tcp://, tls://, ws://, or wss:// (use mqtts:///tls:// for Certificate authentication). Default port is 1883.mqtt://broker.example.com:1883
Reconnect periodTime (in milliseconds) to wait before reconnection attempts5000
Connect timeoutMaximum time (in milliseconds) to wait for connection establishment30000
Reject unauthorizedReject connections with unverified certificates (e.g., self-signed)Enabled/Disabled

Quality of Service​

SettingDescriptionExample Value
QoSQuality of Service level: 0 (at most once), 1 (at least once, possible duplicates), 2 (exactly once).0, 1, 2
PersistentWhen enabled, the broker retains messages and queued deliveries across reconnections (requires QoS 1 or 2). When disabled, a clean session is started.Enabled/Disabled

Authentication​

No Authentication​

SettingDescriptionExample Value
(None)No authentication required for connection-

Username / Password​

SettingDescriptionExample Value
UsernameUsername for broker authenticationmqtt_user
PasswordPassword for broker authentication••••••••

Certificate Authentication​

SettingDescriptionExample Value
Cert file pathPath to the signed certificate file/path/to/cert.pem
Key file pathPath to the private key file/path/to/key.pem
CA file pathPath to the certificate authority file. Required for Certificate authentication./path/to/ca.pem

Data Throttling​

SettingDescriptionExample Value
Number of messages before flushNumber of messages to accumulate before flushing to North caches1000
Delay between flushTime delay (in milliseconds) between automatic flushes of accumulated messages1000

Item Settings​

Each item subscribes to one MQTT topic. MQTT uses a hierarchical topic structure with wildcard support:

SettingDescriptionExample Value
TopicThe MQTT topic to subscribe to. Wildcards supported.sensors/#, plant/+/T

Topic Wildcards​

SettingDescriptionExample Value
#Multi-level wildcardsensors/#
+Single-level wildcardsensors/+/temperature

Use the tester below to see which topics a given subscription filter matches:

Topic tree
▸factory/
▸line1/
○temperature✅
○pressure✅
▸line2/
○temperature✅
○pressure✅
○humidity✅
▸alerts/
▸line1/
○overheat
▸line2/
○overheat
5 of 7 topics matched

Examples