Firebase vs. Firestream vs. XMPP

The Chat SDK is backend agnostic. That means that the UI can be made to support any type of messaging server. To do this, we need to provide a network adapter to allow the Chat SDK UI to communicate with the messaging server. Currently, network adapters are provided for three different backends:

Firebase

The Firebase network adapter provides a full messaging experience using Firebase Realtime Database including:

  • User Accounts

  • User Search

  • 1-to-1 chat

  • Groups, Moderation

  • Presence

  • Supports Android and iOS

  • Uses Firebase Realtime database

  • Max 200k concurrent users

Firestream

Firestream is a new messaging API we've developed. Firestream is designed to be a light-weight messaging API for Firebase Realtime and Firestore. The Firestream library is stand-alone so it can be used with Chat SDK or alone.

Since Firestream doesn't provide any user management features, the Firestream network adapter for Chat SDK uses the Firebase network adapter to handle user accounts, search and presence. Then the Firestream library provides the messaging functionality

  • User Accounts (Provided by Firebase Network Adapter)

  • User Search (Provided by Firebase Network Adapter)

  • Presence (Provided by Firebase Network Adapter)

  • 1-to-1 chat

  • Groups / Moderation

  • Supports Android, iOS, JavaScript, TypeScript, Node.js

  • Uses Firebase Realtime database for user accounts, search and presence

  • Uses Firebase Realtime or Firestore for messaging

  • Max 200k concurrent users (2m for Firestore)

XMPP

The XMPP network adapter allows Chat SDK to inteface with any XMPP server. XMPP is a standard messaging protocol which powers some of the biggest messaging apps in the world including: WhatsApp, Skype, Messenger. Chat SDK is compatible with a wide range of open-source XMPP servers including: ejabberd, OpenFire, Prosody, Tigase, MongooseIM.

  • User Accounts

  • User Search

  • Presence

  • 1-to-1 chat

  • Multi-user chat / Moderation

  • Supports Android and iOS

  • Max 2 million concurrent users per node

So which is the best?

Each of these options has strengths and weaknesses. There isn't any one that's the best but each may be better in a certain situation.

I'll start by talking about XMPP because it has some special properties. I would recommend using XMPP for the following cases;

  • You need your app to scale massively. XMPP can support over 50 million monthly users per node.

  • You need to operate without an internet connection. i.e. over an intranet. XMPP doesn't require an internet connection to function

  • You want to operate in mainland China. Google services aren't available in China and you can easily host your XMPP server in a Chinese datacenter.

  • You need to self-host for data sensitivity reasons or because of data regulations

  • You need to interface with an existing XMPP network.

  • You have server skills and want to save money on hosting. XMPP will work out cheaper than Firebase

The downside of XMPP is that the server setup and maintenance is more complicated.

In general, if you have any of the above requirements, I would recommend XMPP. If not, then the decision is between Firebase and Firestream.

Firestream has two main advantages at the moment. Firstly, Firestream has a light-weight API for JavaScript and Node.js. That makes it ideal if you need to add in chat bots or link the chat to an existing backend server.

The second advantage is that Firestore can scale much further than Firebase Realtime. If you have your own user-management system, then you could just user Chat SDK and Firestream for the messaging part of your app allowing it to scale to a much higher number of concurrent users.

If you have an app with fewer than 10 million monthly users that mainly targets iOS and Android and want a library that's fully featured and easy to setup and run. I would recommend the Firebase backend.