Skip to Content
On this page

Gateway MQTT collection server

For installation, automatic deployment and verification, see Center and edge deployment.

This plugin starts one MQTT listener on a central Gateway and receives variable catalogs, current values, device state, and snapshots from multiple edge Gateways using the TGateway Gateway MQTT protocol. Each edge node connects through its own authorized remote-source identity.

It is not a general MQTT JSON collector. Use MQTT Collection Server for custom Topics and payloads.

Compatible devices and models

Device series / model examplesConnection requirements
TGateway gateway data reporting clientsThe reporting gateway connects as an MQTT client with TGateway data topics and message structure.

Connect an edge client to the center listener

Use this mode when the center accepts inbound MQTT connections. This example uses port 18885, RemoteKey edge-01 and allowed Client ID edge-01-uplink. The gateway Web port is a separate service.

  1. Add this plugin under No channel, choose Tcp and port 18885, and configure TLS when needed. Do not share this listening port with another MQTT server device.

Central Gateway MQTT server TCP18885 listener and TLS settings

  1. Add an enabled remote source with key edge-01, a display name and allowed Client ID edge-01-uplink. Assign its username/password. These are exact case-sensitive identity matches, not Client ID prefixes.

Server source edge-01 Client ID credentials and certificate fingerprint binding

  1. At the edge add MQTT client forwarding, enter the reachable center IP and choose TCP with MQTT3.1.1. Set port 18885 and Client ID edge-01-uplink. The pictured center and edge run on one computer, using 127.0.0.1; use the actual center IP across computers. Match TLS, WebSocket and path settings too.

Edge MQTT client target center address and TCP connection type

Edge Client ID edge-01-uplink and listener port18885

  1. Enter the credentials assigned to this source. The example username is edge-01; use the password assigned at the center. Include the intended source variables in the forwarding group and follow the edge configuration images for fixed Topics and variable-list format. Do not retain the shared Broker example port 18886 or its different Client ID.

Edge upload target uses source username edge-01

  1. In central Protocol debug → Remote gateways, check that edge-01 is Online with current ClientId edge-01-uplink, then request a full snapshot for that source.

Server binds the online session to edge-01 and edge-01-uplink

  1. Open Remote variables, select the source and check its device, variable name, ID, type and access. Remote Collect_OPC_UA/Ramp1 here declares Int32 with ReadOnly access. If a connected source has an empty directory, check edge scope, list upload and fixed payload. Do not use a general MQTT JSONPath address.

Server catalog Ramp1 remote ID Int32 type and ReadOnly access

  1. Synchronize the current source, review the Variable synchronization differences and Confirm and apply. This example adds one mirror with zero conflicts. A catalog count alone does not mean the local variable has been created.

Server synchronization plan adds one mirror with no conflicts

  1. Return to Realtime variables and open the mirror details. Address edge-01/877079827984453 identifies remote Ramp1. Compare its edge value, central current value and collection time. The synchronized type comes from the remote declaration; new mirrors default to read-only with RPC write disabled.

Server mirror source address current value Int32 declared type and ReadOnly access

Identity fieldMeaning
RemoteKeyTopic namespace and mirror source key. Changing only the center key breaks edge routing.
AllowedClientIdExact MQTT handshake Client ID, unique at the center. It may differ from RemoteKey.
Username/passwordCredentials for this source session, not the center Web account.
Client certificate SHA-256Lowercase hexadecimal fingerprint of the TLS client certificate, not its path or the CA fingerprint. When fingerprint binding is used, configure all enabled sources consistently.
QoSMatch protocol delivery requirements on both sides. It does not correct the directory, forwarding scope or guarantee exactly one database insertion.

A newly authorized session for a source replaces its older session. Repeated disconnections can indicate duplicate edge Client IDs, credentials or RemoteKeys; increasing offline timeout does not resolve identity conflicts.

Configure the listener and security

Open the plugin

Open Development Configuration → Collection Configuration, create one collection device, and select Gateway MQTT Collection Server.

This is a shared-listener plugin: configure multiple remote sources inside this one device. Do not create multiple Gateway MQTT server devices on the same listener port.

Configure the corresponding MQTT forwarding target on each edge Gateway. See Gateway MQTT Collection Client, Configure MQTT Upload on Each Edge, for the complete topology and fixed Topics.

Select Gateway MQTT collection server under No channel

Channel and data type

ItemDescription
ChannelEmbedded MQTT listener. Common TCP, UDP, and serial channel fields are not used.
Data typeObject. Variable types and catalogs are supplied by the remote Gateway protocol.

Listener and TLS

SettingDefaultDescription
Connection typeTcpSelect TCP or WebSocket listening.
Port1883MQTT listener port, from 1 to 65535.
WebSocket path/mqttUsed only in WebSocket mode.
Enable SSLDisabledEnables the MQTT TLS listener.
Server certificate-Required for TLS. Select a server certificate from Certificate Management.
CA certificate-Required for TLS. It validates client chains when source fingerprint binding requires client certificates.
Allow untrusted certificateDisabledTemporary commissioning option. Keep it disabled in production.
SSL protocol / revocation check-Configure according to the project TLS and revocation policy.

Remote variables and reliability

Remote sources

Open Remote Sources and add one entry for each edge Gateway allowed to connect.

SettingDescription
RemoteKeyStable protocol key using 1 to 64 ASCII letters, digits, hyphens, or underscores. It is used in Topics, variable addresses, snapshots, and RPC. Do not change it casually after commissioning.
Display nameHuman-readable edge name shown in debug.
EnableEnables connection handling, snapshots, catalog synchronization, and RPC for this source.
QoSQoS used by this source’s fixed protocol messages.
Allowed Client IDEdge MQTT Client ID. It must match exactly and be unique on the listener.
Username / passwordIndependent credentials used by this source. Keep them out of screenshots and logs.
Client certificate SHA-256Optional 64-character lowercase hexadecimal fingerprint used to bind the source to one client certificate.

Each source must have a unique RemoteKey, Client ID, and configured certificate fingerprint. Certificate binding requires TLS. If one enabled source uses fingerprint binding, every enabled source must use it.

Without fingerprint binding, TLS does not require a client certificate; ClientId and source credentials are still checked. With binding enabled, each edge must present the matching trusted client identity.

Protocol and reliability

SettingDefaultRangeDescription
Topic rootTGateway/Gateway-Must be identical on the central listener and every edge forwarding target.
Allow remote writeDisabled-Allows the central Gateway to issue edge-variable RPC writes. Enable only with site authorization.
Snapshot interval60 seconds10 to 3600Periodic full-catalog and current-value snapshot interval.
Request timeout30 seconds1 to 600Timeout for snapshot and RPC requests.
Offline timeout180 secondsGreater than snapshot interval, maximum 86400Marks a source offline after no valid protocol message.
Detailed logDisabled-Records protocol summaries without complete sensitive payloads. Disable after commissioning.

Server Topic root, remote-source editor and remote-write switch

Capacity limits

SettingDefaultRangeDescription
Remote source limit321 to 128Maximum configured edge sources.
Snapshot concurrency41 to 32Maximum simultaneous snapshot or sync tasks.
Inbound payload limit1048576 bytes4096 to 16777216Maximum size of one incoming MQTT payload.
Messages per second2001 to 100000Total message rate entering the parser.
Inbound handler concurrency41 to 64Concurrent JSON handlers.
JSON depth limit648 to 256Maximum protocol JSON nesting depth.
Per-source catalog limit1000001 to 1000000Maximum variables in one edge catalog.
Total catalog limit300000At least the per-source limit, maximum 3000000Maximum variables across all sources.
Pending RPC limit2561 to 4096Maximum simultaneous remote RPC batches.

Increase limits only after checking memory, message traffic, and the number of edge sources.

Server inbound payload, message rate and catalog capacity settings

Address rule

Use the source key and remote variable ID:

{RemoteKey}/{RemoteVariableId}

Example: edge-01/877079827984453, identifying the remote Ramp1 above.

The remote variable ID is reported by the edge Gateway. Do not replace it with the central Gateway’s local mirror-variable ID. See Collection Configuration for common variable fields, imports, and intervals.

Debug and verify

Device debug

Open Development Configuration → Collection Configuration, select the Gateway MQTT server device, open Protocol Debug at the top of the workspace.

FeaturePurpose
Remote GatewaysShows identity, connection, Client ID, catalog size, message counters, snapshot time, and errors; requests snapshots or tests RPC.
Remote VariablesQueries the remote variable catalog by source, keyword, and online state.
DiagnosticsShows bounded protocol diagnostic events filtered by source.
Variable SyncPreviews local additions, updates, missing variables, and conflicts, then applies a confirmed synchronization plan.

Request snapshot and Test RPC affect only the selected source. Synchronize all and Apply plan change local variable configuration; review the differences and impact first.

Verify the configuration

  1. Add one source with a unique RemoteKey, Client ID, and credentials.
  2. Confirm that the edge MQTT target uses the same Topic root and RemoteKey and connects to the central listener.
  3. Confirm that the source becomes online and request one full snapshot.
  4. Find one variable under Remote Variables and create or synchronize its local address.
  5. Read the local mirror value and compare it with the edge Gateway.
  6. Test remote writing only when central, edge, target, and variable permissions all allow it.

Write edge Setpoint from a server mirror

Follow the writable edge point steps to prepare Modbus Slave station 1, zero-based offset 2, and edge Setpoint: address 40003, Int16, Read/Write and RPC write enabled, included in the upload group. The edge still connects to center listener 18885. Keep read-only Ramp1 separate.

  1. Enable Allow remote write in the central server’s Plugin properties and save the device.

Server Topic root and enabled remote-write switch

  1. Request a full snapshot and check that Setpoint declares Int16, ReadWrite and RPC write enabled in the remote catalog. Synchronize the source, review the new Setpoint and unchanged Ramp1, then confirm the plan.

Server remote catalog includes writable RPC-enabled Setpoint

Server synchronization plan adds the Setpoint mirror

  1. Edit the new mirror, keeping address edge-01/877159968292933 and its synchronized Int16 scalar type. Set local access to Read/Write, enable RPC write below and save. Do not replace the final address component with the local mirror ID or Modbus 40003.

Server Setpoint mirror source address Int16 and ReadWrite settings

Enable RPC write on the server Setpoint mirror

  1. Filter central Realtime variables by Setpoint, open Write, enter number 42 and submit.

Enter42 in the server Setpoint mirror write dialog

  1. Read back the center mirror and Modbus Slave zero-based offset 2; both should show 42. For disconnection, access denial or RPC timeout, check source binding, permissions on both sides, the TGateway/Gateway/edge-01/RpcWrite Topic and response diagnostics.

Server Setpoint mirror reads back42

Modbus Slave offset2 receives the server write42

Troubleshooting

SymptomCheck
Listener cannot startPort conflict, connection type, TLS server certificate, CA, and firewall.
Source cannot connectClient ID, username, password, certificate fingerprint, TLS, and listener state.
Source remains offlineRemoteKey, Topic root, edge target state, snapshot interval, and last valid protocol message.
Catalog is emptyEdge forwarding range, snapshot response, payload limit, and catalog limits.
Values from sources are mixedEvery source needs a unique RemoteKey and Client ID, and each local address must use the matching key.
Snapshot times outEdge connectivity, request timeout, message rate, payload size, and MQTT traffic.
Remote write failsBoth remote-write switches, variable permissions, pending RPC count, and response diagnostics.