With any IoT platform, messages that flow through the system are like the blood that keeps it alive. From our previous article, we know that messages arrive via a Listener. But, what is a message? In the context of IoT, devices generate messages, and these messages are generally sent to a server to be processed by a listener. Messages sent to a listener can be thought of as a conversation. The conversations are really at the heart of building an IoT system.
If we break a message down to its most basic form, we can identify three components:
- Who it came from – we will refer to this as the Device ID
- The type of message – we will call this the Message ID
- The data the message sends (optional) – we will call this the Payload
With software there are edges cases, but most of the messages you work with have a Device ID, Message ID, and probably a Payload.
The Device ID is a unique value that is assigned to each device to specifically identify where the message came from. Within the universe of all devices connected to your system, each device should have a unique ID. This can be the serial number of the device or it can be assigned when the device is provisioned.
Once we know which device has a message for us, we can look to the message ID to learn what it is trying to tell us. When we think of Device and Message IDs, we have to realize that they can come in all shapes and sizes depending on how the the data is sent. For example, the message may come in as a REST/HTTP web request (see the example below). You may recognize this as something you would type into your browser.
The Device and Message IDs may be part of the request. In the example above, the Device ID is dev001 and the Message ID is msg001. In some cases, the values might be in hidden parts of your request as http headers. In other cases, they may be contained in the actual contents of the message. We have no requirements regarding how this should work and in many cases the decision is left up to the developer writing the firmware on our devices.
Being able to identify both the Message and Device ID is critical to building an IoT system. In a traditional system, you write code specific to each device to gather this information or you have the firmware author change their code. At Software Logistics, we believe that there is a better way and have developed a proven technology where you can configure, rather than code, the important step of identifying the Device and Message IDs.Be sure to check out our full IoT Basics series:
Be sure to check out our full NuvIoT Basics series:
- NuvIoT Basics Part One: Be a Good Listener
- NuvIoT Basics Part Two: Getting the Message
- NuvIoT Basics Part Three: A Good Plan
- NuvIoT Basics Part Four: Routes and PEMS
- NuvIoT Basics Part Five: Time to Get to Work
- NuvIoT Basics Part Six: Get Published