Functions of Mosquitto


maybe this is a stupid question, but I can’t find an answer.
What’s the function of Mosquitto?
Apache is responsible for the data transfer between the raspberry and emoncms?
Or is apache using mqtt instead of tcp/ip?

Please give me a short description.

Thanks in advance for your help!

HTTP and MQTT are 2 different transport methods used by emoncms.

The Apache server is, as you say, responsible for data transfer between the RPi and a remote emoncms, as HTTP(S) is generally used to post to and WAN connected self-hosted emoncms installs.

Mosquitto is the MQTT server (or broker to give it its correct name in MQTT terminology) that manages the flow and distribution of MQTT messages, MQTT is generally used to pass info around a LAN for easy access by other local devices. MQTT is used on the emonSD/Pi image so that the data can also be seen by openHab and nodered etc.

Both methods can coexist and both have their strengths and weaknesses, and although “generally” speaking the above is true, either MQTT or HTTP can be used for both local and remote data so you could esily have a fully HTTP setup with no MQTT at all, but since all the viewing of emoncms data/dashboards/graphs and apps etc is done over HTTP(S), you cannot have a MQTT only setup if you are self-hosting emoncms.

If you are using the hosted service you can only post via HTTP(S) as MQTT is not yet supported, but you do not need an Apache server running to do that. You may need the Mosquitto broker (server) if you are using MQTT locally and then sending data on to via HTTP(S) as is the case with the emonSD/Pi.

1 Like

Thanks for your help, Paul!
Now I got it :slight_smile:

1 Like