can MQTT be used to implement Request / Response behavior

A.Alqadomi picture A.Alqadomi · Apr 9, 2013 · Viewed 9.5k times · Source

We are planning to use MQTT to deliver messages from our server to an android devices we decided to go with the open source server mosquitto.

in most of the cases this is enough.(Publishing / subscribing ) but we have a cases where the client need to send parameters and get response from the server. i know the direct approach is to go with Http (Servlets for example) . but can we achieve this using MQTT since it would mean lower bandwidth consumption to the user ?

Answer

ralight picture ralight · Apr 10, 2013

Yes, it just requires careful design of your topic structure. As a very simple example, you could publish to control/<client id>/request and subscribe to control/<client id>/response