Can I use MQTT for my use case?

So, I have a bunch of mobile devices (millions) and will have a backend system. My needs / usage: 1. Collection of data from devices and sending to the server. 2. To send push messages from my backend system to individual or groups of devices.

So, given this scenario, does it make sense to use MQTT to communicate between my backend and devices? One of the misunderstandings that I have is that in precedent No. 1, devices are publishers, and some system in the backend will be a subscriber, whereas for use case No. 2, devices are subscribers for push messages, and the backend the system will be a publisher, is this possible? Or am I thinking about it wrong?

+4
source share
2 answers

Having worked through a few examples (for example, a mobile telemetry system with push notification) that match this usage pattern, I can say that MQTT can fit perfectly. Any MQTT client can act as a publisher or a consumer, there is no difference.

You just need to design your structure so that it matches the data sent in any direction, but it should not be difficult.

+3
source

All in all, MQTT is perfect for your use case # 1 and use case # 2.

Please keep in mind that you are likely to have problems with this backend, because there are (as far as I know) MQTT libraries around which you can handle such high bandwidth.

A slightly different approach would be to have the broker directly contact the backend, similarly in this blog post

Here's an interesting discussion on the MQTT mailing list on this topic.

+1
source

Source: https://habr.com/ru/post/1497892/


All Articles