I'll be developing web application (most probably an Express.js REST API) that will include user management, device management by users. There will be users which will sign in and log in to the system. Then they will be able to add/modify/remove devices which can be connected using MQTT. They will issue commands on these devices with some predefined commands or using a console. They will also see the outputs of their issued commands, and also incoming periodic status messages coming from devices.

This application (dashboard) is planned to run on web and mobile. So, I thought that developing a REST API for this application could be very on point.

There's some questions which run around my mind before I get into coding this REST API. I think that to get messages from devices I will need to be connected to each of them on the background continuosly. This might cause some traffic issues and I'm not sure if I can listen many devices at the same time. I think I should implement some functionality to the backend to close connections which is idle (not being monitored by any user or not being issued any commands) after a few minutes automatically. As far as I learned about MQTT, it's a lightweight protocol, that being said it's efficient on bandwidth due to some IoT devices might be using cellular data or radio frequencies to communicte using MQTT. Maybe I shouldn't need to close/open connections based on user intereaction on the backend.

What do you guys think about that? What would be a good design for this application?


Side note: I'm not very familiar with MQTT, never used it before. As far I learned from my researches about it, it has something called MQTT broker which behaves like a central server/publisher/router between many clients and many devices. This might solve some issues or help us about the design.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.