First, I'm growing fond of using MQTT to send and receive data across different sensors and clients in my home. That is because the flexibility to send unlimited data categorized by a topic, and unlimited clients to subscribe to one topic from an MQTT broker. Second, I'm not qualified to discuss MQTT in-depth. I got to know MQTT sometimes last year (2017) when following tutorials to set up a weather station and sensors using Node-RED. Anyhow, I will try my best to present to you some info. Another good place to start is Wikipedia.
If you don't have time to read about the theory, and wanted to set up an MQTT broker, I posted another tutorial another tutorial just to do so.
To explain what is Message Queuing Telemetry Transport (MQTT) in my understanding, I prepared a diagram as above. In nutshell, MQTT is an ISO standard, and a product such
mosquitto-client, two packages I used build MQTT broker on a Raspberry Pi, have to comply with that standard. The MQTT broker then becomes a medium for publishers to push a message into and subscribers to listen to a target topic.
The combination of Arduino PubSubclient library with ArduinoJson, thanks to its creator knolleary and bblanchon, makes easier for the tinkers and developers for a set of tools from sensors to a target equipment or an end client.
An implementation using the design above is shown below. In this weather station tutorial, the publisher is the ESP8266 with some sensors, and the subscriber is an SQL Application that record data and store in database.
Let move on with create Database and display some data.