Facebook relies on HTML5 WebSockets and Web Workers
Facebook for Firefox becomes official, with an announcement from Mozilla and a more detailed explanation of the tech behind it from Facebook. The first Firefox Social API app became available weeks ago and is supported in Firefox 17, the latest stable release.Until now though, the app was still labeled as a beta. Now, Facebook is going to start promoting it and supporting it like any of its other Messenger apps.
Unlike any of its other Messenger apps though, the one for Firefox uses standard web technology, along with the Firefox-only Social API.
The Social API only handles the browser integration and Mozilla wants it to become a standard, so that other browsers can implement it.
The heavy lifting though is done by standard HTML5 tech. The asynchronous connection is done via WebSockets.
This ensures that Facebook Messenger for Firefox can keep a connection to the Facebook servers open at all times without using up all that much data or having to constantly refresh it.
"Messenger for Firefox is the first Facebook product to use WebSockets at scale. We rely on our existing chat servers, and added the ability to handle WebSocket connections," Facebook explained.
"On top of that we use the MQTT protocol, which we already use in the mobile Messenger apps and in Messenger for Windows to communicate with our chat servers while consuming less bandwidth," it added.
At the same time, the app is able to function without requiring its own tab by using HTML5 Shared Workers to handle the background tasks, something that required custom implementations on the web until now.
"This worker provides a mechanism for communicating and synchronizing across the different content elements for the product," Facebook continued.
"Messenger for Firefox is able to take advantage of having a centralized location to fetch data asynchronously and synchronize the state across the user’s Facebook notifications, friend requests, messages, ticker stream and chat tabs without duplicated fetching," it explained.