*3.2. Modeling the Notification Message Structure*

As stated in the Main Components section, the notification generator can build customized notifications and plan their delivery by using the information stored in the non-structured database. Notifications are dispatched to the proper smart devices thanks to the notification dispatcher and the MQTT broker. In addition, the recipient devices also have the technical ability to send acknowledgement notifications to the dispatcher (if required).

To build a flexible and scalable system, the notification message structure has been modeled to be independent of the notification mechanism, the application's context and the target device.

Notifications are encapsulated within MQTT messages and therefore, both, the notification devices and the notification dispatcher should implement the MQTT stack and operate as MQTT clients. While the notification devices use an embedded lightweight version of the MQTT client which can be loaded into the memory of the microcontroller; the notification dispatcher, for its part, implements a full-featured standalone client.

Since the non-structured database and the logic that governs the notification generator and the notification dispatcher work with JSON data, the notification has also been modeled as a JSON object which can be enclosed in the MQTT message, instead of using plain text. The JSON syntax provides a flexible mechanism to build a general notification scheme that can be adapted to many application's contexts and notification devices.

The use of this notification model is very valuable. When the notification is defined and queued to be delivered, the generator does not know which device would be used to deliver the notifications. Therefore, a flexible format allows storing the notification content independently to other metadata. Moreover, the same notification can have content in different formats (e.g., audio, text, and figure) and that information would be used depending on the device that is selected to deliver the notification.
