Applicable Versions
Applicable to all Versions


Applicable Releases
v13


MQTT (Message Queuing Telemetry Transport) is a lightweight, publish-subscribe messaging protocol designed for low-bandwidth, unreliable networks. It is one of the most popular protocols for the Internet of Things (IoT) and M2M (Machine-to-Machine) communication.

The following method can be used to model a simple MQTT application using HTTP. In this scenario, we'll use GET requests to simulate both publishing and subscribing to topics.

1. Topic as HTTP Request URL: We can use the HTTP Request from client to server to represent MQTT topics. A separate HTTP application can be configured for each topic from the respective client.

2. Publishing to a Topic: To simulate publishing a message to an MQTT topic, use the HTTP Request parameters. For publishing, again we'll use HTTP GET requests from the clients. Configure the Inter Arrival Time (in seconds) for each client to control the publishing frequency. When a client wants to publish a message, it will send a GET request to the corresponding server. Please note that here the server need not send anything back in response. So, in this case, the page size can be set to the minimum possible value.

3. Subscribing to a Topic: To simulate subscribing to an MQTT topic, again use the HTTP Request parameters. Configure the Inter Arrival Time (in seconds) for each client to represent the subscribing frequency. When a client wants to subscribe to a topic, it will send a GET request to the corresponding server node. The server will respond with an HTTP response, whose Page size can be set corresponding to the topic.

4. Message Size and Page Properties: Use the HTTP Page Properties to simulate the size of MQTT messages. Configure the Page size Distribution (Constant or Exponential) and Page size in bytes to represent the variability in message sizes. The server's HTTP pages will contain the messages to be sent back as responses to subscribers.

5. Broker/Server Handling: The HTTP server can be treated as the broker. The server will handle incoming GET requests from clients for both publishing and subscribing. For publishing, the server will not send any reply. For subscribing, the server will respond with the HTTP page.

6. Client and Server IDs: As before, configure unique client and server IDs for each HTTP application to differentiate between multiple publishers and subscribers in the simulation.

Here's the updated example of how the HTTP application model in NetSim might look like:

Consider an IoT network in NetSim with devices Wireless_Sensor_1, Wireless_Sensor_2, Wireless_Sensor_3, Wireless_Sensor_4, Wireless_Sensor_5, 6_LOWPAN_GATEWAY_6, ROUTER_7, WIRED_NODE_8


We model a simple MQTT application with topics: Temperature and Humidity, using 4 HTTP applications. We will use the HTTP Request parameters to control the publishing and subscribing behavior and the HTTP Page Properties to simulate the message size as shown below:

  1. Topic: Temperature
    1. HTTP Application 1
      1. Application name: MQTT Publishing-Temperature
      2. Server: Wired_Node_8
      3. Client: Wireless_Sensor_1
      4. Inter Arrival Time:
        - Distribution: Exponential (for publishing frequency)
            - Time(s): 5
      5. Page Properties:
        - Page size Distribution: Exponential (for message size variability)
        - Page size in bytes: 2 (for example)
            - Page count: 1 (for example)
    2. HTTP Application 2
      1. Application name: MQTT Subscribing-Temperature
      2. Server: Wired_Node_8
      3. Client: Wireless_Sensor_1
      4. Inter Arrival Time:
        - Distribution: Exponential (for publishing frequency)
            - Time(s): 15
      5. Page Properties:
        - Page size Distribution: Exponential (for message size variability)
        - Page size in bytes: 100 (for example)
            - Page count: 10 (for example)
    3. HTTP Application 3
      1. Application name: MQTT Publishing-Humidity
      2. Server: Wired_Node_8
      3. Client: Wireless_Sensor_2
      4. Inter Arrival Time:
        - Distribution: Constant (for publishing frequency)
            - Time(s): 8
      5. Page Properties:
        - Page size Distribution: Constant (for message size)
        - Page size in bytes: 2 (for example)
            - Page count: 1 (for example)
    4. HTTP Application 4
      1. Application name: MQTT Subscribing-Humidity
      2. Server: Wired_Node_8
      3. Client: Wireless_Sensor_2
      4. Inter Arrival Time:
        - Distribution: Constant (for publishing frequency)
            - Time(s): 10
      5. Page Properties:
        - Page size Distribution: Constant (for message size)
        - Page size in bytes: 50 (for example)
            - Page count: 5 (for example)
In this example, the assumption was that one HTTP server acts as a common broker for all the topics. This means that all the clients (publishers and subscribers) interact with the same HTTP server to publish and subscribe to different topics.
The configuration done for one of the Applications in NetSim is shown below:

For each HTTP application configured in NetSim, there will be two columns of metrics in the Application Metrics table of the Simulation Results window as shown below:


The results shown above are for a 100-second simulation with parameters configured as tabulated above. Here the Source and Destination ID columns represent the Client or the Server ID. HTTP Request is sent from Client to Server representing MQTT publishing and subscribing. HTTP response is sent from the server to the client representing the MQTT response from the server. The cases with low throughput of 0.00001 are those where we have set a very low page size of 2 bytes to consider no response from the MQTT server for publishing messages from the clients.

Attached here is an experiment file associated with the NetSim network discussed above. Users can download, import, go through the properties, and run simulations to understand the configuration.


1. Download the attached MQTT_IoT.netsimexp
2. Go to Your Work -> Import 
3. Browse and select the downloaded file for the Source Location option.
4. Make sure the Import experiment into the current workspace option is selected.
5. Click on the Import button.

With this approach, we can simulate a simple MQTT-like behavior using HTTP GET requests and HTTP pages as responses within the limitations of NetSim. Again, please note that this is a basic approximation and may not fully replicate the intricacies of MQTT, but it can serve as a simplified simulation for experimentation within the constraints of the simulator.