MQTT protocols were created for machine-to-machine communication, and are preferable for small devices with low memory and power. CoAP protocols were written for interconnection with the web and are now used by constrained IoT devices.