Client/Server vs PubSub over MQTT

OPC UA Client/Server and OPC UA PubSub over MQTT solve different problems. They share OPC UA data concepts, but they do not expose the same interaction model.

OPC UA Client/Server compared with OPC UA PubSub over MQTT

OPC UA Client/Server exposes an address space. OPC UA PubSub over MQTT publishes messages.

OPC UA Client/Server

In the standard Client/Server model, OPC UA is primarily an information modeling system. The server exposes an address space, and clients interact with that address space through services.

The address space can contain:

  • ObjectTypes and objects.

  • VariableTypes and variables.

  • Structures and enumerations.

  • Methods that clients can call.

  • References that describe relationships between nodes.

Clients use NodeIds and browse paths to discover and access data. This makes Client/Server a good fit when the client needs context, structure, metadata, type definitions, and remote method calls.

OPC UA PubSub over MQTT

PubSub over MQTT is message-oriented. A publisher creates dataset messages and sends them through an MQTT broker. A subscriber receives messages and decodes the payload.

At the application level, a PubSub message is closer to a Lua table, JSON object, or dictionary than to a browseable address space. Metadata can describe the fields, but subscribers do not browse a live server address space, create sessions, or call methods through MQTT PubSub.

This makes PubSub a good fit for distributing current values, telemetry, events, or sensor data to many consumers.

Comparison

Primary model

Client/Server exposes a browseable OPC UA address space. PubSub over MQTT publishes dataset messages.

Communication pattern

Client/Server uses request/response between a client and server. PubSub uses publish/subscribe through an MQTT broker.

Discovery

Client/Server clients browse nodes and references. PubSub subscribers know topics and decode messages.

Identity

Client/Server is NodeId-centric. PubSub is field-, topic-, and message-centric.

Methods

Client/Server supports remote method calls through the Call service. Methods are not part of the PubSub message flow.

Best for

Client/Server fits rich device models, semantic data, remote operations, and integration with OPC UA clients. PubSub fits telemetry, fan-out distribution, cloud ingestion, and simple sensor data streams.

Choosing the right model

Use Client/Server when:

  • Clients need to browse and understand the device model.

  • Data should carry strong OPC UA semantics.

  • The application needs Read, Write, Browse, or Call services.

  • You need sessions, user authentication, and endpoint security negotiation.

Use PubSub over MQTT when:

  • The goal is to publish values or events to many receivers.

  • MQTT infrastructure is already part of the system.

  • Subscribers do not need to browse a live OPC UA address space.

  • The data can be represented as fields in a message.

Many systems use both. A device or gateway can expose a full OPC UA server for engineering tools and local control, while also publishing selected values over MQTT for dashboards, cloud services, or data pipelines.