LogoLogo
HomeSign UpGithub
  • Home
  • Release Notes
  • Getting Started
    • Create your first Test
    • Create Run Settings
    • Analyze the results
      • Job Summary
      • Logs
      • State
      • Payload
    • Look deeper with Metrics
  • Concepts
    • Workspaces
      • Role Based Access Control (RBAC)
      • Invitation Management
      • GitHub Integration
      • Deletion of Workspaces
      • System Status
    • Understanding Tests
      • Stages Management
        • Init Stage
        • Running Stage(s)
        • Finished State
      • Generating Messages
        • Scripting Environment
        • State Object
      • Response Handler
      • Preview Tests
      • Exporting/Importing Tests
        • Import OpenAPI JSON/YAML
      • Locking/Unlocking a test
    • Stateful Simulation
      • Mapping the IoT device lifecycle
    • Protocol Settings
      • MQTT
      • HTTP
      • Using other protocols
    • Run Settings
      • Network Simulation
      • Execution Strategies
      • Client Distribution
    • Scenarios
    • Glob Storage
    • Metrics
    • Mailbox
    • Licensing and Limits
    • Deployment Models
  • Additional Helpers
    • External Libraries
    • Inbuilt Libraries
    • IoTIFY Helper Functions
      • Job Functions
      • Messaging Functions
      • Glob Functions
      • Metrics Functions
      • Mailbox Functions
      • Data Generation Functions
  • platform integrations
    • AWS IoT Connector
  • Guides
    • Smart City
    • Smart Home
    • Load Testing Kafka
  • IoT Testing
    • Overview
      • Feed offline sensor data from Google Sheets to your IoT platform
    • Functional Testing
      • Basic functional test
      • Geofencing Validation
    • Performance Testing
      • MQTT end to end latency Measurement
    • Security Testing
    • Load Testing
    • Test Automation & CI/CD integration
  • API
    • Simulation API
    • Glob APIs
    • Metrics API
  • Glossary
  • Create Account
  • TEMP
    • Getting Started
      • Beginner
      • Developer
      • Tester
    • Walkthrough
    • Protocol Settings
      • CoAP
      • Raw (TCP/UDP/TLS/DTLS)
      • LWM2M
      • NONE
    • Under the hood
    • Google Sheets API
    • Azure IoT
    • Losant IoT
      • Losant Connector
      • Parking Space Management
      • Waste Management
      • Connected Truck
      • Delivery Van
    • Google Cloud IoT Core
    • IBM Cloud
      • Simple Messaging
      • IBM Bluemix: Monitoring Energy Consumption
    • Dweet.io
    • JMeter and why it fails at IoT
Powered by GitBook
On this page

Was this helpful?

  1. Concepts
  2. Protocol Settings

MQTT

MQTT is the most widely used and known protocol for IoT devices. Let's have a basic look at MQTT and how could we use it with IoTIFY

PreviousProtocol SettingsNextHTTP

Last updated 2 years ago

Was this helpful?

The MQTT protocol is based on TCP and is one of the most commonly used publish/subscribe protocols in use today. For a detailed overview of MQTT let's refer you to the Hivemq tutorial which has covered this subject pretty well.

What should you know about MQTT?

  1. MQTT requires that all client connect to a broker. There are several public broker available today and you could launch your own MQTT broker as well.

  2. The clients of MQTT publish data on the topics which are hierarchical in nature. E.g. A topic could be formed for a university as follows:

    • /university/

    • /university/EECS/

    • /university/MECH/

  3. MQTT protocol provides three quality of service(QoS) levels:

    1. QoS 0: at most once

    2. QoS 1: at least once

    3. QoS 2: exactly once

Overview of MQTT Template Settings

In the protocol tab, you can modify several settings for the MQTT Protocol:

MQTT Endpoint: The name or IP address of the server along with the port number. It must be a public server IP address that is reachable over the internet.

Keep Alive: The keepalive timer duration for the protocol. The hello message is sent every keepalive interval to make sure the server is aware of the client being connected.

QoS: QoS settings ensure that the delivery of the message is guaranteed. Higher the QoS Settings more will be the latency of packet sending as the server will need to ensure that the messages are delivered with a guarantee.

Retain: Whether the server should retain the messages for a future delivery.

Publication Topic: The topic on which messages should be published. The topic field is scriptable, i.e. you could use template strings in Topic to dynamically change the content of the topic. For example,

/iotify/temperature/{{client()}}   // will translate to /iotify/temperature/0 

Any field within {{ }} will be evaluated at runtime and will be replaced with the actual contents.

/iotify/temperature/{{state.topic}}    

Will change to whatever state.topic variable value is at the run time. For performance reasons, make sure that the fields are not too complex.

Subscription Topic: (Can be enabled when required) The topic to which the client should subscribe. This field is scriptable but only at the beginning of the simulation (after the Init stage). For example, if you use {{state.topic}} within the Subscription Topic string, the subscription will be initialized to whatever value the topic had past the Init stage. However, the content will not change as the simulation runs.

Timeout: The timeout value to establish a connection with the server and wait for the messages to be sent. If the operation doesn't complete within the timeout period, it is marked as failed.

Security: If the connection to the server requires authentication, the required fields can be passed here. For MQTT connection we support:

  • Username and Password combination

  • Pre-Shared Keys

  • Certificates

Introducing the MQTT Protocol - MQTT Essentials: Part 1
Logo