Categories
Controller FAQs Frequently Asked Questions

How do I monitor messages sent over an MQTT connection (for example, to M3)?

One of the most powerful features of the BAC is the ability to send messages over a network connection to game control software. One of the most popular protocols for this connection is MQTT, which is a simple industry standard designed for sending short messages between two points. Because the BAC is built on MQTT, you have the option of using off the shelf packages like M3 or creating your own control solution using a tool like Node-RED.

Because MQTT is an open standard, you can also connect to the server and monitor the ongoing communications using desktop tools. This can be a great option if you’re having trouble getting a link established and are not sure where the problem is in the system.

We recommend the MQTT Explorer project for most users; it’s a convenient graphical browser for MQTT messages and is available for most major platforms. If you prefer the command line, we recommend the mosquitto_sub tool available as part of the Eclipse Mosquitto project.

While you can run MQTT Explorer from the same computer as your MQTT server (also known as a broker), the best test results will come if you can use a second computer on the network, as this will validate that your firewall and network are configured correctly.

To set up MQTT Explorer to monitor your BAC, install it from the link above, then open the application. You’ll see a server connection window:

In this window, set the “Host” field to the network address of your MQTT broker. (For most people with M3, this is the address of the computer running M3.). Then, click Save and Connect.

MQTT Explorer will connect to your server and display a tree view of topics and messages that updates live as messages are sent:

If MQTT Explorer gets stuck on the connection page and never connects, eventually showing a “Disconnected from server” bar in the bottom corner, it’s likely that your MQTT broker is misconfigured. One common possibility is that the server computer is running a firewall that’s blocking access from other computers (to disable Windows Firewall, follow these instructions). Another possibility is that you are using Eclipse Mosquitto 2.0 as your server; the new 2.0 version has default security settings that disable access from remote computers. The Eclipse project has instructions for enabling remote access here.