Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

MQTT (Message Queuing Telemetry Transport) is a popular protocol for connecting IoT (Internet of Things) devices and applications. In this article, we will explore how to test MQTT in xPort Edge using the Mosquitto Broker.

To test MQTT functionality in xPort Edge, you would typically need the following:

MQTT Broker: This is the server that receives all messages from the clients and then routes them to the appropriate destination clients. In our case, we are using the Mosquitto Broker.

Topic: Topics are used to filter messages. They are the primary method of routing messages based on the content of the publishing client. When testing MQTT, we need to define and use specific topics for publishing and subscribing.

Client: In this context, the xPort Edge device acts as an MQTT client. It will publish messages to the broker and subscribe to specific topics to receive messages from other clients.

Testing Tool: In our case, we are using MQTT Explorer. This type of tool allows you to connect to the MQTT broker and interact with it, such as publishing messages, subscribing to topics, and monitoring message traffic.

By having these components in place, we can effectively test the functionality of MQTT in xPort Edge, ensuring that it can successfully publish and subscribe to messages via the MQTT broker.

Installation of MQTT Broker


The first step is to install the MQTT broker. The MQTT broker typically listens on its default port, which is 1883.

After installing the Mosquitto Broker, open the Mosquitto.conf file and locate the "listener" configuration. Here, assign the listener port to 1883. Additionally, set the "allow_anonymous" connection to true. Save and exit the configuration file.

image-20240403-095928.png

image-20240403-095229.png

Configuration in xPort Edge


In the xPort Edge device, after selecting MQTT as the protocol in Line 1 configuration, go to the MQTT section in the menu and assign the IP address of the PC where MQTT is installed. Specify the topic name for publishing and ensure that the same topic name is used for subscription. In addition to that, enter the Device ID, which must be unique to the device connected to the server.

image-20240403-110054.png

Testing MQTT Functionality

To test the functionality of MQTT in xPort Edge, we can use the MQTT Explorer. In the MQTT Explorer, enter the name of the host machine where the MQTT broker is running and listening on port number 1883. Then, click "CONNECT."

Next, send data from the xPort Edge serial port to publish to the MQTT Broker. Any device or application subscribed to the particular topic will receive the data. Additionally, the functionality can be verified using the MQTT Explorer.

By following these steps, we can effectively test MQTT functionality in xPort Edge using the Mosquitto Broker.

image-20240403-104502.png

image-20240403-113755.png

image-20240403-114355.png

  • No labels