Developing an IoT Application spans across multiple technologies. It is mandatory to ensure every component involved is made the best. So that every one can work together in the best possible way. Our previous posts design the Edge, design the Data and designing the IoT agents are a few articles targeting how you should get your edge device ready for the collaboration. This article covers the best practices for building the IoT manager application.
Technologist always view implementation in their own best known protocol. Having said that MQTT is the most preferred protocol option of implementing the Edge device communication. . But one of the worst advice give across the web for building manager application is just subscribe to the Broker for all the topics using (#) as another MQTT client and collect data and with that do whatever you want to do. But we need much more for building manager application. Here are the few requirements for building it.
Need for Complete data
You need the complete data to perfectly design the manager application. People often misinterpret Payload that comes in the messages as a complete data. But beyond that, you need the security keys used, the IP address, the local time of message receipt, the confirmation acknowledgement states, error packets if any, number of connections / connections and a lot more information.
State of Message Delivery
MQTT is best for communication between the Broker and edge device. But the state of delivery of the various QoS levels are limited to the Broker and the client. The subscribers are not provided with it. This is not only applicable to MQTT, but for any protocol. The IoT manager application should be able to know the state of each message delivery for all the transaction with the edge devices seamlessly.
Security & State of Device
In any IoT Implementation, especially in Industrial ones, the uptime of the edge device is important. So monitoring the edge device for the connectivity and also generate Uptime reports for the connectivity can be done. The manager application needs the complete edge device status data for reporting. Security can be monitored closely when we have the edge device error rate, frequent change in IP or security keys used and more with the manager.
In almost every implementation, there is going to be a gateway behind which there is going to be a lot of sensors / actuators. These edge devices needs to be managed individually by the IoT manager application. We have designed our Platform in such a way that the gateways can send a particular MQTT packet to the platform conveying the individual device details behind it. Such an information will be available only with the Broker and cannot be passed on to some other edge device.
Mobile won’t work 100% on MQTT
The even worser part is the same advice is provided for the mobile IoT application development as well. All protocol communication except FCM push will be closed by the Mobile OS when the app goes to the background. You can use MQTT to send messages to be broker when it is not avoidable, but never listen to MQTT by keeping it alive at the background. You are going to drain a lot of battery.
How should I build IoT Application
MQTT is a great protocol for edge device communication. But not for the manager / control application. The best way to implement is to closely integrate your application with the data. In our MQTT Broker we store the data into the data store which can be queried directly by any application. We also provide an option to extend the storage, so that the developer can store it anywhere he want and REST API for integration. So choose a MQTT Broker that provides the option for data storage and you can write your application over it. You should be able to directly talk to the MQTT Broker to manage the device (not via MQTT).
If your MQTT Broker does not allow direct integration, allow the broker to store all the data into a Database and build a module that can expose all the data via REST for your further processing. REST provides all the information as available in the data store / big data storage for your processing which is mandate for building a world class IoT manager application.
Feel free to try our products from our downloads page. Schedule a free consulting now for knowing the best practices for building your IoT Application today.