News & Notes

This page contains IOT, MQTT and Mosquittto news that I think you may find useful as well as quick notes that may be helpful but don’t justify a tutorial of their own.


Specification for Transfer of OpenC2 Messages via MQTT Version 1.0

I’ve never heard of openc2 messages but it looks interesting, and shows how MQTT is being adopted.

The spec is here

Please rate? And use Comments to let me know more

Testing Last Will Message

To test last will message you need to cause the client to disconnect abnormally. If you are using a script CTRL+C may or may not work.

A better method is to stop the client loop which means that the client will not send a ping message and hence the server will see it as down and send the last will message.

Setting a very low keep alive interval of 20secs is ideal for testing.

Please rate? And use Comments to let me know more

Mosquitto v2 Notes

Mosquitto v2 was a big upgrade from v 1. The v1 track is still being maintained and is currently at v 1.6.12.

The blog has a quick overview of the important changes and I recommend you take a look here

However important ones to note are:

By default it requires authentication and doesn’t listen on a network address.

The following simple configuration file will make mosquitto start like previous versions:

listener 1883
allow_anonymous true

This also affects usage when starting the broker using the port number e.g

mosquitto -p 1884

This will no longer work like before and so you need to use a configuration file. There is currently no command line switch to overcome this.

Please rate? And use Comments to let me know more

MQTT Cool

This was pointed out to me by a reader and is an HTTP to MQTT gateway.

It uses an API similar to Paho, The following is taken from the web page here.

We provide you with a JavaScript library that works in any existing browser, including mobile browsers, as well as Node.js.

The library exposes an Eclipse Paho-like API. Any HTML page can easily become an MQTT client, able to publish and subscribe to/from MQTT topics, irrespective of which MQTT broker you are using. This way, web pages can exchange messages with IoT devices and existing MQTT applications as well as interact with other web pages in real time.

Similarly, any Node.js application will be able to access any MQTT broker and produce/consume messages.

Please rate? And use Comments to let me know more

CloudMQTT Free Plans Unavailable

A while ago a published a tutorial on using CloudMQTT and in that tutorial I used their free hosting plan.

Recently CloudMQTT have stopped this plan and I was asked for an alternative.

A that time I had just helped someone with a connection problem to Beebotte and so I needed to sign up using their free plan which you may want to look at as an alternative.

Please rate? And use Comments to let me know more

Republishing Web Pages Over MQTT

Some data currently being published as web pages and sent over http is far more suited for being sent over MQTT.

So what happens to existing applications that publish over http.

Well IMO nothing as it is relatively easy to take this existing data and republish it over MQTT without having to modify the existing application.

Doing it this way would greatly reduce the load on the application server and reduce costs.

A while ago I developed both a python script and a node-red flow to do this if you haven’t seen the tutorial then here it is.

Please rate? And use Comments to let me know more

SSL Certificate revocation

Q- What happens if a server certificate gets stolen?

A- It can be revoked. There are a number of ways that a client(browser) can check if a certificate is revoked see here.

However the python client doesn’t check for revoked certificates.

Please rate? And use Comments to let me know more

Mosquitto Broker Connections

I have received several questions regarding raspberry pi and Mosquitto . They  are mainly concerned about the pi being able to handle the number of connections.

I ran my broker connection tester on my pi and got 1016 before being denied.

max-tcp-connections-mosquitto

I was curios about this limit as it was mosquitto but the tcp daemon.

It seems that users are only allowed 1024 connections by default and so the user running mosquitto was limited you can change this see here

Please rate? And use Comments to let me know more