How to use Publish Subscribe with MQTT

You have heard the mentioning of MQTT Message Queuing Telemetry Transport. What is it? Can I use? The MQTT is a protocol frequently used in the IoT Internet of Things space. It’s used for publish and subscribe mechanism. You would usually have either a Dumb Broker and Smart Client or Smart Broker and Dumb Client. There are different kind of brokers like the Kafka technology to subscribe to an exact topic. The MQTT to subscribe using query over topic pattern. sMAP to subscribe using query over per-stream key-value store. Finally some kind of data portal to subscribe using query over ontological model.

How to use Publish Subscribe with MQTT

Dumb vs Smart Broker

Why even have a broker for this. The broker is really just software running on a computer, device or on cloud, it can can eliminates insecure connections by it’s design. The broker setup is easily scaled up from one to thousand devices and finally it’s able to handle and manages all client connections states. The broken doesn’t compromise the security nor hinder the network.

  • Improves upon secure connections
  • Scalable
  • Manage all state from clients
  • Less network strains

Message Queuing Telemetry Transport (MQTT)

MQTT is a sub protocol used for IoT devices like sending notifications to your mobile. Behind the hood it’s publish subscribing with MQTT messaging protocol. It’s designed for IoT and therefor a lightweight solutions to low-bandwidth, high latency and unreliable networks. MQTT makes it easy to send high volumes of sensor data to the cloud or on-premise servers. The clients connect to the MQTT broker, which handles the communications between all devices. There are multiple properties when talking about this type of broker

  • Subscriptions are against the topic patterns
  • Identifying patterns can be expressed using wildcards
    • Topics matched against patterns
    • Topics use / as separators
    • Plus + sign matches a single level
    • Hash # tag can match multiple levels