I'm planning to do a project using MQTT protocol. As I'm planning to use C++, I've stumbled upon Eclipse Paho MQTT client API. At this point, I'm curious as to why many of the API's divide the client/broker functionality and support only one of them. I've found out that the functionalities (e.g. QoS, SSL and so on) provided by different open-source API's also differ. Do separate API's (one for client and one for broker) work well with each other? For example, I'm considering using Eclipse Paho for the client side and Mosquitto for the broker side. Also, can I only use the functionalities provided by the both sides?


I suggest you phrase your questions in a more specific way, for example: does Paho MQTT Client work with Apache MQ?

For the reason the libraries are separate, is that they require very different resources.

MQTT Client
The client requires only a socket and some little formatting overhead for its basic functionality, so it can be deployed to simple architectures like Microcontrollers.

MQTT Broker
The broker does a much more complex job of gathering all messages, processing their string components to place the messages in the right queues, updating clients on incoming messages, keeping track of persistence, and more depending on the broker and its characteristics.

The resources in terms of computing time and memory footprint are much higher than the client, hence the libraries are more often than not designed to run on much more powerful machines. And for the same reason it's very hard to find an embedded MQTT broker.

MQTT library compatibility
I personally do not have direct experience, but MQTT is an OASIS standard, now at version 5.0. You can read its compact documentation on their website http://mqtt.org/documentation

So my understanding and expectation is that libraries of different suppliers abiding to the same standard version, are expected to be compatible. That said if the supplier added specific functionality which is outside of the standard, then you have to pair the libraries to have guarantee of support of that functionality

  • Makes sense. Thank you! – user55011 Jul 4 '19 at 1:20

Not the answer you're looking for? Browse other questions tagged or ask your own question.