The lecture slides. The class description.
MQTT Chat Demo We can use this during the class.
Broker and Gui
- The first thing that we need is a GUI tool for making sure that our MQTT server is working. So please download and install MQTT Explorer. I really like both it and MQTT because they correctly handle hierarchy.
- The next thing we need is an MQTT broker. The normal thing is to start with the free one over at Test.mosquitto.org. Good to read their page with port numbers.
- You have the MQTT protocol, the web socket protocol, encrypted and unencrypted. Please connect to topic mqttClass and send 4 messages, one for each protocol.
- Should I move these class notes to Github?
Here are the docs for the Python client. Let us read the connect, on_connect, message, on_message, log methods. on_disconnect, message_callback_add(), on_unsubscribe, publish, single, multiple, socket.
Here is the list of Paho Python Examples. The options example. is useful. Here is the important example. How to create an MQTT Class. We start with it.
- Connect to the client.
- Subscribe to mqttClass
- Publish a message
- Python Asyncio Example. 3 different classes. Just way way too complex. use two connections and queues, much much easier.
- Okay, now you get your MQTT diploma! See how easy it is.
Next head over to CloudMQTT, get yourself your own account. And connect to it.
- In the console, connect to the client.
- I will give you each a server. Login Click on Menu->Node->Manage
A very important part of the class is to discuss what people are doing.
- What do you want to do with MQTT?
- What application are you building?
- What broker will you use?
- How are you hosting it?
- I released a Simple Topic Logger. No one was interested. But it gave me the next idea.
- I am very close to release lets-encypt-mqtt and lets-encrypt-mqtt-gui. The first one gives you a docker container with NGINX, MQTT and Lets Encrypt. Give it your domain name and an email address, and it will give you https certificates, and secure channels. It will have an encrypted and in-the-clear mqtt channel. It will have 4 web sockets channels. Half encrypted, half unencrypted. Half restricted to the same origin host, the other half globally accessible. It is like mqtt cloud in a docker container.
- A future release ill feature web editing of the configuration files.
- And then I want to release my simple topic logger.