Video summary
Basic MQTT
Main summary
Key takeaways
Summary
The video introduces MQTT and its publish–subscribe model, with demonstrations using MQTT Explorer and Mosquitto.
Network Context and Why MQTT Is Useful
The instructor distinguishes between a local network, where devices communicate within a building or network, and the public internet, which connects devices and services more broadly. IoT devices may need to send information beyond their local network, so they rely on communication protocols.
The lecture contrasts HTTP with MQTT. HTTP messages can have comparatively large headers, which may be inefficient when IoT devices send small amounts of data frequently. MQTT is presented as a lightweight option for devices with limited memory, battery power, or data quotas. The lecture highlights MQTT’s small fixed header, described as two bytes.
MQTT Publish–Subscribe Architecture
MQTT uses a broker to pass messages between devices:
- A publisher sends a message to a topic.
- The broker receives the message and forwards it to clients subscribed to that topic.
- A subscriber receives messages for the topics it follows.
- A device can act as a publisher, a subscriber, or both.
Unlike the HTTP request–response pattern described in the lecture, publishers and subscribers communicate through the broker rather than addressing each other directly.
Public brokers are convenient because they do not require users to set up a private server. However, because they are shared services, topic names should be distinctive to reduce collisions and accidental receipt of unrelated messages. Public brokers should not be treated as secure places for confidential information.
Topics and Topic Hierarchies
Topics organize messages, and subscribers receive messages by subscribing to the relevant topic. Topics can be arranged in levels separated by /, for example, to represent a campus, building, floor, room, and device.
The instructor gives examples of controlling lights, air conditioning, or projectors with topic-based messages. The lecture also covers wildcard subscriptions:
+represents one topic level.#represents multiple lower levels.
The payload is the actual message, such as a device command, and is chosen by the programmer. The same topic can carry different kinds of messages, so devices must interpret the payload consistently.
Quality of Service (QoS)
The instructor introduces three MQTT delivery levels, comparing them to package delivery:
- QoS 0 — “At most once”: The message is sent without confirmation. It may be lost, but delivery has the least overhead.
- QoS 1 — “At least once”: Delivery is acknowledged, but a message may arrive more than once.
- QoS 2 — “Exactly once”: A more involved exchange helps avoid duplicate delivery and has the greatest protocol overhead.
The key lesson is to choose a QoS level based on the importance of reliable delivery while considering the additional traffic and processing required.
Retained Messages and Last Will
The lecture describes two broker features:
- Retained messages: The broker keeps the latest message for a topic so a new subscriber can receive that value immediately, rather than waiting for the next publication.
- Last Will and Testament (LWT): A publisher can arrange for the broker to publish a message, such as an “offline” notice, if the publisher disconnects unexpectedly.
Hands-on Demonstrations
Using MQTT Explorer
- Download MQTT Explorer for the computer’s operating system. The instructor recommends a portable version where available.
- Create a connection and choose MQTT as the protocol.
- Enter the public broker address
test.mosquitto.organd the standard MQTT port1883. - Leave the username and password blank for the demonstration.
- Connect and inspect topics and messages published by other users.
- Publish a message to a topic and use a topic filter to view the relevant message.
- Separate topic levels with forward slashes (
/); the instructor warns against confusing them with backslashes.
Using Mosquitto from the Command Line
- Download and install Mosquitto for the computer’s operating system and architecture. The instructor recommends restarting the computer after installation.
- Open a command prompt in the Mosquitto installation directory and start the broker.
- In another command prompt, run a subscriber against a topic, initially using the local host address
127.0.0.1. - In a separate prompt, publish a test message to the same host and topic. The subscriber should display it.
- To test communication through a public broker, change the host in both the publisher and subscriber to
test.mosquitto.org, keeping the topic the same.
The instructor also mentions that MQTT messages can be sent from a mobile MQTT application. The stated goal is to connect MQTT to IoT devices in a later lesson.
Speakers and Sources Featured
- Speaker: One unnamed instructor leads the lesson and software demonstrations.
- Other voices: Students occasionally answer questions or make brief comments; they are not identified by name.
- Tools and services: MQTT Explorer, Mosquitto (broker and command-line publisher/subscriber tools),
test.mosquitto.org, and a HiveMQ public broker, whose name is garbled in the subtitles.
Rate this summary
Your feedback will help improve summaries.
Improve this summary
Reprocess with a stronger model when the summary feels incomplete or inaccurate.
Translate summary in another language
Ask questions to this video
Chat for follow-up questions, clarifications, and source-backed answers.