•July 27th 2020
Chat Messaging APIs
SendBird, Stream, and PubNub are the three largest providers in the API-driven chat market. There are pros and cons to each. However, in this post, we’ll talk more about the many features that users of chat messaging applications expect and how Stream provides those features out of the box and where Firebase falls short.
In-House Chat Solutions
You can build a custom in-house chat solution on top of many different technologies. For larger-scale applications, developers typically use coding languages such as C++, Go, or Scala because these specific technologies are cost-effective at scale. Due to the large-scale applications deployed on top of Stream's Chat infrastructure, our team has decided to take advantage of the many benefits that Go has to offer. To further scalability, we've coupled our codebase with a combination of new, performant, and battle-tested technologies such as RocksDB and Raft for Stream Chat.
If you're building an in-house solution for chat, developers commonly choose Socket.io or Firebase. Socket.io provides the real-time portion of chat but does not scale with an influx of users without throwing more memory hogging machines at it. Additionally, Socket.io does not offer additional features out of the box, such as data-persistence. Firebase, on the other hand, will take care of both real-time as well as data persistence; however, scaling with the application's user base often becomes a cost issue rather than an infrastructure issue.
Features of a Chat API
Consumers are accustomed to and expect a highly polished chat experience. Applications such as WhatsApp, Slack, Facebook Messenger, and iMessage are well-known and commonly used within households and work environments. The applications mentioned above have focused many years of development and customer research on building rich and interactive chat experiences for unique use cases and the masses.
Generally speaking, because real-time chat has become so popular among individuals, many features are expected to be available because it is the new stand. Below is a shortlist of the most common features that applications implement:
- Typing indicators: Show when the user is typing
- URL previews: Show an image, text-description or video when adding a URL in a chat message
- User presence: Show who is online
- Reactions & Threads: Support modern messaging best practices such as reactions and threads
- Unread counts: Show the number of unread messages that need attention
- Offline storage: Keep the chat working, even if the network connection is unstable (an important feature of mobile apps in particular)
The above bullet points are only a small subset of the number of features available in most chat applications. Here’s the full list that Stream Chat provides out of the box:
If you compare the feature set of Firebase to Stream Chat, you will quickly notice that Firebase does not offer any of the features that Stream Chat provides out of the box. Building custom features means that additional time will be required to allocate development time for the build of functionality that is core to your chat experience.
Building a fully-featured chat API on top of Firebase requires a significant amount of development overhead, equating to an unknown amount of time to get to market. Stream Chat provides everything you need to build a custom chat experience using our core chat API.
Should time not be an issue and you don't need a lot of features, Firebase may seem like a simple approach to get your application off the ground. However, developers often fail to understand that building features that may look easy – such as unread counts – is possible, but will eventually turn into a mess when it's time to scale. Stream Chat focuses on providing an efficient approach for developers to build a custom chat application faster and scale by leveraging every feature within the Stream Chat API that has been carefully thought out.
When to Use Firebase for Chat
If you intend to use Firebase for chat, keep in mind that you need to invest in a significant amount of upfront development – and we all know that comes at a high cost. Firebase is, for the most part, intended for smaller applications. On that note, building chat on top of Firebase will quickly drive your team into a combination of technical and cost-related issues, especially as your user base grows. For example, there is a maximum hard number of 100,000 concurrent connections on Firebase, whereas Stream does not impose any limits on this number.
Firebase can be a valid option for some teams, though. It mostly makes sense if:
- You’re not paying for your developer's time. (e.g., you are two co-founders working on a new business, or someone working on a hackathon, etc.)
- Your chat use case is basic, and you don’t expect the usage of chat to grow
Firebase is generally not a good fit if:
- You need to sync significant development into your application to build most basic chat features and are worried about the scalability of your chat application as the user base grows
Simply put, as you scale it becomes more problematic and expensive than using a proven chat API provider, so you will never recoup your upfront investment that occurred during development.
For most use cases, if you’re considering building chat in-house, I recommend using C++, Go or Scala, in addition to your database and other infrastructure that you choose.
Stream vs Firebase
While Firebase has an API and various SDKs to accommodate any coding language, it does not offer help on the UI/UX side. Furthermore, Firebase does not specifically cater to applications within the chat ecosystem, so you will be left in the dark when it comes to building out features from scratch.
If you are building a chat focused application on top of Stream Chat's API, Stream offers a large number of component libraries and SDKs for React, React Native, Flutter, Swift, and Kotlin. Stream has built additional products to improve the speed of taking your product from ideation to reality, allowing your team to significantly reduce the build time required to get your application in the hands of users.
Building chat in-house is a complicated and expensive process. While you can use Socket.io or Firebase as your platform to build on top of, you will undoubtedly run into issues related to scalability and performance and, more importantly, the cost that can hinder your business a whole or potentially cause it to fail.
There are three API-driven chat products on the market, and they were all built for specific reasons around different business models. In my opinion, Stream is at the forefront of innovation as a company, as we take in every idea that developers and teams around the world provide to us in the form of feedback. We also believe that supporting our customers is fundamental, and we do that by providing them with the absolute best service and transparency possible.
It’s always important to weigh your options when building a product around any technology, whether it’s an open-source technology or a paid infrastructure driven by an API. Stream Chat outweighs the competition by a landslide from every angle, including transparent pricing, extreme scalability, high-touch support, and a unique feature set. Hopefully, this shows why Stream is not only an alternative to Firebase but a much more complete solution for your messaging needs.