Smart device to the apps
A simple flow of data from a sensor to a user device will be as follows:
As you can see from the previous figure, the data originates at the sensor; this data is read by the Raspberry Pi 3 and published to the MQTTS broker (Mosca) via the Wi-Fi router. Once the broker receives the data, it will send the same to the API engine, which will persist the data to the DB. Once the data has been successfully saved, the API engine will send the new data to our app, to show the data in real time.
An important thing to notice here is that the API engine will act as an MQTT client and subscribe to topics on which the device publishes the data. We will look at these topics when we go over the implementation.
Generally, the data in this flow would be a typical sensor transmitting data.