MQTT 5.0 · UADP
MQTT for OPC UA PubSub
MQTT 5.0 as the broker transport of OPC UA PubSub. The OPC UA simulator's GUI, headless program and MCP server publish and subscribe UADP messages through a broker.
What it does
- Choose UADP over MQTT on the PubSub tab of the OPC UA simulator, or use the headless and MCP tools.
- MQTT 5.0 over TCP: publish with QoS 1 and subscribe to the same topic.
- Content type application/opcua+uadp and the UAMessageType user property.
- UADP network messages of 1 to 64 fields, up to 64 KiB.
- Publish and subscribe in one simulator to test with a single broker.
Example
MQTT has no SDK binding. These are the real scenario and command files that the OPC UA headless simulator (pdcomm-opcua-headless) runs, and the broker configuration of the tutorials.
PubSub over MQTT publisher scenario
[
{
"command": {
"action": "configure",
"config": {
"pubsub": {
"transport": "mqtt",
"role": "publisher",
"broker": "127.0.0.1:1883",
"topic": "opcua/uadp/data/100/line1",
"publisher_id": 100,
"writer_group_id": 1,
"dataset_writer_id": 1
}
}
}
},
{ "command": { "action": "pubsub_start" }, "expect": { "running": true, "transport": "mqtt" } },
{
"command": {
"action": "pubsub_publish",
"fields": [
{ "type": "Double", "value": 21.5 },
{ "type": "Boolean", "value": true },
{ "type": "String", "value": "RUN" }
]
},
"expect": { "sequence": 1 }
},
{
"command": {
"action": "pubsub_publish",
"fields": [
{ "type": "Double", "value": 21.75 },
{ "type": "Boolean", "value": true },
{ "type": "String", "value": "RUN" }
]
},
"expect": { "sequence": 2 }
},
{ "command": { "action": "pubsub_stop" }, "expect": { "running": false } }
]The scenario file of the MQTT tutorial. pdcomm-opcua-headless --scenario publisher-scenario.json publishes two UADP messages to the broker and checks each step's result.
PubSub over MQTT subscriber commands
{"action":"configure","config":{"pubsub":{"transport":"mqtt","role":"subscriber","broker":"127.0.0.1:1883","topic":"opcua/uadp/data/100/line1"}}}
{"action":"pubsub_start"}JSON commands for the headless simulator, one per line. cat subscriber.jsonl - | pdcomm-opcua-headless starts a subscriber; typing {"action":"pubsub_received"} afterwards shows the decoded messages.
Local Mosquitto configuration
# Local development broker for the PDComm MQTT tutorials.
# Plain TCP on the loopback interface only, without authentication.
listener 1883 127.0.0.1
allow_anonymous true
# Keep nothing between runs and log every connection and packet.
persistence false
log_dest stdout
log_type allThe Mosquitto 2.x configuration of the MQTT tutorials. mosquitto -c local.conf opens a test broker without authentication on loopback port 1883.
Related modules
opc.tcp · UA Binary
OPC UA Client
Put an OPC UA client into your application. The SDK handles secure channels, sessions and certificate validation.
Learn moreopc.tcp · UA Binary
OPC UA Server
Put an in-memory OPC UA server into your application. Register variables, expose them on secure endpoints and answer clients while you call poll.
Learn more