Although the GCM framework for Android and the APN(Apple push notification) for iOS seems like a perfect solution for cases like real time messaging, why did FB decided to go with MQTT? is this a lingering question in your mind ? Here are some of my thoughts.
1. MQTT will help position FB and Messenger to the masses and 3rd world countries.
FB messenger works in 2 flavours web and mobile. I believe the mobile version i.e.FB messenger App and FB App is NOT only available of for Smart phones, it is also available in feature phones. so FB messenger is not only for Android and Apple. MQTT was originally positioned to support low foot-print devices like sensors talking to a network where the networks are expected to be of typically low bandwidth and high latency. Think about feature phones without 3G/4G support. Operating at Edge/GPRS, putting out data packets in MQTT might have made more sense to FB than HTTP or XMPP. Think about countries or continents with poor network infrastructure.
2. X-platform push notification made easy
X-platform push notifications can be implemented in multiple different ways. One possible way is to go with APNS/GCM and use Amazon Simple Notification Service on top of that. FB might have chosen the route of building their own push notification infrastructure.
Really what is a Push Notification infrastructure ? It is nothing but a distributed publish/subscribe infrastructure. Building one to suit our use cases isn’t a big deal . MQTT also comes with a set of QoS parameters which makes things more reliable. Internally MQTT requires a persistent TCP/IP connection.
While those are my opinions. Here are some facts/trends which tells that going with MQTT isn’t a big deal. Just choose a flavour based on your use cases.
- There are lot of open source MQTT broker implementations, you can download and run in your infra. e.g Moquitto
- There are lot of cloud hosted MQTT services.e.g CloudMQTT
- There are a lot of GitHUB repos for the full push notification solution.