MQ Telemetry Transport Protocol known as MQTT is designed for devices which run on low power and low bandwidth. It is a lightweight publish/subscribe messaging protocol which means any other device can subscribe to a particular topic.
HTTP/HTTPS is designed as a request-response protocol for client-server computing which never bother about power usage and has lot of data overhead.
Use MQTT if:
- The device you are using is running on battery cell and you don't want to replace that every x number days (MQTT is optimized for battery usage while HTTP/S is not)
- Need faster response
- Need to have pub/sub mechanism ( If you want to push messages to many clients)
- Need to send data reliably with different levels of QoS
Do MQTT offer as much security as HTTPS?
MQTT relies on TCP as transport protocol, which means by default the connection does not use an encrypted communication. To encrypt the whole MQTT communication, most many MQTT brokers – like HiveMQ – allow to use TLS instead of plain TCP.