==================== MQTT PubSub Examples ==================== Monitoring OPCUA server changes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It is possible to connect MQTT client to OPC UA server and subscribe to node changes. To do this you need to create MQTT client and connect it to a created OPC UA server. .. literalinclude:: ../examples/pubsub/mqtt_publish_node_subscribe.lua :language: lua `Full source <_static/pubsub/mqtt_publish_node_subscribe.lua>`__ Publishing data to MQTT broker ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ It is possible to publish data to MQTT broker without OPC UA server. To do this you need to create MQTT client, configure fields for messages, connect it to a MQTT broker and start publishing. .. literalinclude:: ../examples/pubsub/mqtt_publish_serverless.lua :language: lua `Full source <_static/pubsub/mqtt_publish_serverless.lua>`__ Subscribing to MQTT messages ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ OPCUA PubSub messages can be received and decoded by OPCUA MQTT client. Decoding of a message is required to decode binary messages. JSON messages are decoded and transformed to same the format as decoded binary messages. Thus application can subscribe to either binary pr JSON messages and OPCUA MQTT client will return messages in the same format. .. literalinclude:: ../examples/pubsub/mqtt_subscribe.lua :language: lua `Full source <_static/pubsub/mqtt_subscribe.lua>`__