Chat solutions: what to choose between Firebase, SendBird, Node.js + Socket.io?

Fora Soft
9 min readSep 2, 2020

By Ilya A

People frequently come to us with a request to create a text chat. Some of them want a messenger with a chat being the main or the only function. Others need to add chat into different projects, such as telemedicine. In this article, we’ll take a look at the most popular options for chat creation.

All solutions for chats can be split into two categories:

  1. Ready-made chat platforms, such as Firechat, SendBird.

They have prepared functionality for main chat options. The developer needs to put a small effort and time to add a chat into an app or a website. But the behavior of functionality has strict borders by a platform creator, and possibilities for customization are limited.

2. Technologies for exchanging data between client and server, such as Firebase Cloud Messaging, Node.js + Socket.io.

They allow building a very flexible chat solution upon them. Those technologies take time to implement but offer unlimited possibilities for customization.

All the four solutions are cross-platform, they work on the web, iOS, Android.

Firebase Cloud Messaging

Firebase Cloud Messaging is a platform for information exchange between a mobile app and a server. It’s widely used for notification send-out, and it can be used to build a chat on its foundation.

Advantages:

  • Free for products with up to 100 simultaneous users.
  • As a Google product, one can expect stable work when used correctly
  • With comprehensive documentation and high popularity, developers can find any answers quickly, which saves time and money
  • No need to buy an additional server, you can do everything on the Firebase server
  • Thanks to the Firestore database, the servers will automatically come into existence or be eliminated when they are not needed, which will save you a ton of money. Node.js and socket.io will make you create scaling separately
  • Data is cached by default and is available for search in chat offline

Disadvantages:

  • Difficult search inquiries are difficult or impossible to realize

For example, inquiries like “find all messages with “Hello!” that a user received last year from all users whose nicknames start with an A”.

The thing is when using Firebase Cloud Messaging, you are limited in choosing a database. It’s either Firebase Realtime Database or Firestore.

Firebase Realtime Database is a NoSQL database, where data is stored as JSON. It has lots of advantages compared to traditional SQL databases. The possibilities for creating a new search inquiry are limited by a developer to keep productivity levels.

To deal with that problem, Google came up with the Firestore database. It’s a NoSQL database but its search and data structuring possibilities are vastly increased. However, difficult search inquiries still pose a bigger problem than those in SQL databases or NoSQL databases like MongoDB. Some of them are impossible, others will take much more time to develop.

  • Up to 200k simultaneous users in Firebase Realtime Database, up to a million in Firestore

Firebase Realtime Database is limited by 200k connections in the database. It’s roughly the same as 200k simultaneous users. Firebase developers think out of 10 million active app users there are 200k of those who would use the app at the same time.

Firestore offers up to a million users at the same moment.

  • Paid from 100 simultaneous users

When using Firestore, the cost is determined by read/write operations in the database. The more data is there, the more expensive it will be. For instance, by Firestore calculation, a small up (50k installations and 5k active users daily) the usage cost will be $12–14 a month. For a big app (10 mil installations with 1 mil active users daily), the cost will be $2951,52 monthly. There are borders within which Firestore is free to use.

With Firestore Realtime Database the cost is determined by the amount of data stored in a base and downloaded from there — approximately $5 a month for each stored gigabyte and $1 a month for each downloaded gigabyte.

Therefore an app that processes many read/write in the database operations, it will be cheaper to use Firebase Realtime Database.

The most profitable option would be to use Firebase Realtime Database for one type of data and Firestore for another.

For example, for a typical e-commerce app, operations that involve reading a list of goods will run every time a user opens the app, and the number of operations will grow as more people use it. The size of the list, however, won’t depend on the number of users. For an app like that, the most profitable option would be storing the list data in Firebase Realtime Database (to not pay for multiple read operations), and storing the user data in Firestore, as storing 1 gigabyte of data is cheaper there (source).

Using Firebase Cloud Messaging is free itself, which means that you only pay for using the database, hosting, and authentication.

  • Works slowly when searching offline

In Firestore, if there are hundreds of documents in the base, the offline search will be slower, which will worsen the UX. For instance, in a chat with a hundred channels, when you have to find one without internet access, the search will work noticeably slower.

  • The developer needs experience working with NoSQL to build a convenient and effective database structure

Firestore has a limit of 1 write operation in a second for 1 document. The document is a structural part of a Firestore database. The Firestore database consists of documents organized in a collection. The document is practically a set of “key-meaning” couples. It is actually a flexible limitation: if you go for 10 read operations at the same time once, Firestore will process them correctly. If, however, you keep sending thousands of requests into the base at a rate of more than 1 per second, Firestore will return errors for some requests.

Firechat

Firechat is a framework for chat creation, and it was made by the Firebase team using Firebase as a foundation. Firechat uses Firebase for authorization, sync, storing data. Firechat provides API for a chat, that allows user authentication; forwarding messages, images, and files; group chats creation, sending out invitations. Here are the links to their official website and project code.

Advantages:

  • Saving time and money on developing

A ready-made API for the chat main functionality allows not to create a realization of those functions by yourself

  • Same advantages as with the Firebase Cloud Messaging

Disadvantages:

  • Not all functions are possible to realize

If you use a ready-made API for the chat functionality, you can only realize the functions in offers. For instance, it doesn’t support showing unread messages, deleting messages, and has a limitation of 100 users in the chat group. The full functionality list is difficult to find, but you can get an impression by their API methods here

  • Same disadvantages as with the Firebase Cloud Messaging

Firechat only uses Firebase Realtime Database from the box. There is no choosing a database, like in the Firebase Cloud Messaging, Firebase Realtime Database, or Firestore.

Sendbird

Sendbird is a ready-made chat platform. It offers a multitude of prepared features, including an indication of the number of unread messages, blocking users, and admin dashboard.

Advantages:

  • Many functions

Lots of features are already realized and work right away: message or file exchange, invitations, users blocking, typing indication, editing messages, automatic translation, admin dashboard, group chats for up to 100 users

  • A ready-made UI with limited customization possibilities

Creating a UI and its design isn’t necessary. Sendbird offers standard UI options, which you can use as is. You can also apply your own design on top of the standard one, changing the color and form of chat components. So, we can simply add Sendbird with default settings into our product and get a char with a default design. Then, customize some components whenever the need arises.

  • Scales automatically

You don’t need to worry about having too many users so your server doesn’t catch up to the number of requests, New servers will create themselves. Sendbird supports more than a million simultaneous users. It uses AWS.

Disadvantages:

  • You can’t realize all functions

Chat and functionality behaviors are strictly set. A user logs in and gets access to a list of channels. They can choose an existing channel or create their own. Channels are either public or private. Users can exchange messages in either one.

This is the standard structure for the majority of chats. If you need something more exotic for your product, it will be really problematic to realize that with SendBird. Some functions are outright impossible to implement, others can take much more time than if they were created from scratch, for example, with Node.js and socket.io. For example, you can’t create threads to answer a message, like in Slack.

  • Not all available functions can be realized the way you see it

SendBird provides more customization opportunities than it seems. There are serious limitations, too. For example, SendBirds allows storing additional information about any user, but not more than 5 parameters. Let’s say, those will be a name, last name, city, sex, weight, eye color. So, it is not nearly enough for dating chats

  • Not as popular as Firebase and Socket.io

Popularity is an important metric when choosing a framework. The more popular a framework is, the more developers using it are out there. It helps get important resources, support, answers. If other pros and cons are equal, this will help make the development faster (and cheaper if you pay for time)

  • Price

Depends on the number of users. The base package costs $400 monthly for 5k active users. With 100k active monthly users, the price will go up to $5000. Or even $7600 if you also want automatic message translation and advanced moderation. For products with more than 100k users, the price is decided individually. There is a 30-day trial period

Node.js + Socket.io

Server platform Node.js, going with the real-time data exchange library Socket.io helps build a chat with unlimited customization possibilities.

Advantages:

  • Allows realization of any functionality

The developer has full control over all components: interface, logic, and server data and endpoint can be whatever is needed. For instance, it helps organize threads to answer chosen messages, which you can’t do in SendBird. You can implement message deleting, which is nowhere to be found in Firechat.

  • Scales

Provides an opportunity to realize automatic scalability that depends on the load. It’s possible to do on AWS and other ready-made solutions, such as Oracle. However, scalability isn’t provided right away, it has to be developed by a programmer.

  • You can choose the database type that suits your product best

For instance, if in the future product you are going to realize many difficult search inquiries, you can choose the SQL database, instead of using Firestore or Firebase Realtime Database that don’t support these functions

  • The chat works quickly

Client and server exchange messages directly, which results in fast work. When you use Firebase Cloud Messaging, the message goes from your server to Firebase server, and only from there will it travel further to the device. It’s important to mention that, though, that if there is a 0,5s delay, it’s not critical for a text chat.

  • Free to use

Open-source free solution — you don’t have to pay monthly for this technology. But please note that you have to pay for a server rent, where your product is based. However, this cost is usually way lower than that of Firebase Cloud Messaging or Firechat. We will discuss forecasting server costs in a different article.

Disadvantages:

  • Requires more time and money, as the developer creates all functions from scratch
  • Not everyone can develop the chat. You will need someone with the relevant experience

To sum it up

Ready-made platforms will give you quick results because the functionality is already there. But you are limited to those functions.

Node.js and socket.io allow creating any chat you need but each function will have to be developed from zero. It takes time and money.

What to choose?

The first thing to think about, when answering this question, is what kind of solution fits you and your company best.

  • If your chat requires a minimum base functionality, you don’t have high level of requirements to it, then Firechat or a Firebase Cloud Messaging-based solution is the way to go
  • When you expect a chat to be more advanced, take a look at SendBird. Compare monthly payments to SendBird against creating a chat from zero on Node.js and socket.io
  • If there are a lot of requirements for a chat or you need lots of customized options, Node.js and socket.io are your friends!

Why at Fora Soft we recommend Node.js + socket.io?

Developing the chat functionality on Node.js + socket.io takes about 40 hours. Embedding and customizing a prepared one requires around 24–32 hours.

Ready-made chats charge you every month. It is more expensive than paying just for servers in the case of Node.js + socket.io. A little increase in the development costs is usually recouped in a few months.

In exchange, they:

  • Are not bound to any limitations. They can implement any functionality in the future
  • Do not depend on third-party components that developers can just stop updating someday, and your chat will stop working.

--

--

Fora Soft

Video and Multimedia Software Development Company