Nice write-up that explains the basics of the two, and how they work (and how you can use it).
Minimal MQTT: Building a Broker