Rat Signal Part 2: The Broker

August 2, 2020

In an MQTT-based system, a central “post office” is needed to manage the flow of data. This is the job of the broker. A broker manages the subscriptions of the edge devices, or clients, and pushes the right data to the right clients whenever data is published to the right topic.

Topics can be organized into a number of different levels. There aren’t any rules for topic hierarchy and you are free to organize your topics however you want. It makes sense, though, to logically organize topics into a hierarchy of increasing specificity. For example, if my home was loaded with different sensors, my topics might look like:

home/bedrooms/guest/temp
home/bedrooms/master/lights/closet
home/garage/humidity
home/appliances/coffeemaker/status

I could have a client device that subscribes to the home/bedrooms/master/lights/closet topic to check if the bedroom’s closet lights are on. Using wildcards, I could subscribe to all of the bedroom’s sensors by subscribing to home/bedrooms/master/#.

The Mosquitto Broker

Eclipse Mosquitto is an open source and lightweight MQTT broker that is used as the “post office” for Rat Signal. I’m only interested in certain data points for a certain surf break so my message topics will be organized as such:

surf/time/timestamp
surf/time/timeText
surf/height/minHeight
surf/height/maxHeight
surf/windSpeed
surf/period
surf/rating/solidRating
surf/rating/fadedRating
surf/rideable

These topic names correspond with data provided by Magic Seaweed. More on that in the next post.

Mosquitto is deployed to my home server using Docker. More on deployment in a later post.


The Rat Signal Series: