- Topics
- /
- Realtime technologies
- &Realtime technologies
- /
- Pusher vs PubNub vs Firebase: pros, cons and key differences
Pusher vs PubNub vs Firebase: pros, cons and key differences
In this article we compare three third-party solutions you can use to deliver realtime experiences - Pusher, PubNub, and Google Firebase. We cover the pros and cons of each, use cases, key differences, and available alternative solutions to help you make an informed choice.
What are Pusher, PubNub and Firebase?
Pusher, PubNub and Firebase all provide managed infrastructure allowing you to rapidly build applications, with a variety of features for facilitating realtime feature development. They all provide SDKs for building client and server components, with support for various platforms across web, desktop, mobile, and IoT.
Pusher overview
Pusher is a PaaS platform based on a pub/sub architecture. It provides a free sandbox option for evaluation and development with up to 200K messages per day and 100 concurrent users.
In return you get access to key features including authentication, detecting user presence, reacting to events, and more. These features can save a lot of development time.
Pusher primarily uses WebSockets, but will also fall back to HTTP in environments where WebSockets aren’t supported. It can transport text and binary content out of the box.
Pusher has multiple datacenters available to help with scalability, but unlike other realtime platforms it requires you to choose a single datacenter for an app to reside in. This has implications for performance, reliability, and availability.
Key features of Pusher:
Authentication: Pusher requires a separate token-based authentication request for every channel. Pusher only supports JWT in certain products.
Flexible messaging patterns: One-to-many, many-to-many, many-to-one, possible due to the use of pub/sub channels.
Push notifications, via their Beams product.
User presence.
Event responses via webhooks.
PubNub overview
PubNub is a PaaS platform based on a pub/sub architecture. It provides message transport between server and subscribed clients, and facilities for handling authentication, detecting user presence, sending push notifications, reacting to events, and more. You can get started with PubNub for free, but will begin to incur monthly charges as you scale.
PubNub primarily uses HTTP long polling as its transport mechanism, with MQTT support available for constrained bandwidth environments. It can transport text and binary content (provided it is Base64-encoded), plus it provides file-sharing capabilities.
PubNub has 15 global data centers to spread the load of your applications, providing rapid message delivery and scalability.
Key features of PubNub:
Authentication: PubNub supports token-based authentication, but not JWTs.
Flexible messaging patterns: One-to-many, many-to-many, many-to-one, possible due to the use of pub/sub channels.
Message persistence via a storage API.
Push notifications.
Serverless functions.
User presence.
Firebase overview
Firebase is a Backend as a Service (BaaS) platform that helps you build, test, release, and monitor web and mobile apps for end-users. While it initially started as a realtime database, Firebase now provides various services and features for building realtime apps.
Firebase Realtime Database and Cloud Firestore can push realtime updates to client devices following any changes to the database. They use WebSockets for transport. There’s also Firebase Cloud Messaging, a service that allows you to send native push notifications and notification messages across platforms (iOS, Android, web). It can transport text and binary content out of the box.
Firebase has 17 global data centers to spread the load of your applications, providing rapid message delivery and scalability. You can replicate Cloud Firestore data across multiple regions, which has advantages for performance, scalability, and availability. The Realtime Database however is single region-only.
Key features of Firebase:
Authentication: Firebase supports token-based and JWT-based authentication.
Two database options for storage.
Push notifications.
User presence.
Event responses via webhooks.
PubNub, Pusher, and Firebase use cases
PubNub and Pusher are suited to a range of realtime use cases including:
Chat/messaging apps.
Realtime polling, statistics, and graphs.
Location-aware apps, such as realtime mapping and tracking.
Live entertainment with interactive, realtime features such as sports commentary, live score updates, team stats, and live polls.
Multiplayer games including realtime environment updates, stats and leaderboards, and in-game text/voice chat.
Education/virtual classrooms providing live Q&A sessions, multiple chat rooms to split classes into groups, videos, and live educational broadcasts with chat and interaction.
E-commerce and marketplaces with live product and price listing updates, chat features to get support and discuss sales, and more.
Firebase could also be used to create such apps, and in fact is commonly used to create multiplayer games and chat apps, facilitated by its WebSocket support and push notifications, delivered via FCM.
What are the pros and cons of Pusher, PubNub and Firebase?
Pusher pros and cons
Pros of Pusher:
Fallback transports: Pusher primarily uses WebSockets, but will also fall back to HTTP in environments where WebSockets aren’t supported.
Good security: Token-based authentication, JWT in certain contexts, and end-to-end encryption.
SDKs: Good range of SDKs, targeting every major development platform and programming language.
Cons of Pusher:
Single-region: Pusher has multiple datacenters available in different regions, but unlike other realtime platforms it requires you to choose a single datacenter for an app to reside in. All realtime traffic must therefore be routed through a single datacenter, regardless of a user’s location. This has implications for performance, reliability, and availability.
Weak messaging QoS guarantees: Pusher does not guarantee message ordering and delivery. If a Pusher user is disconnected, and messages are published while they are disconnected, messages are not guaranteed to reach the client upon reconnection.
Lack of message history: Pusher does not provide message history by default.
Lack of platform integration: Pusher does not provide integrations with services such as event streaming platforms (e.g., Kafka) and serverless platforms (e.g., AWS Lambda, Azure Functions, etc.).
Pricing transparency: Pusher handles pricing via different tiers, which can be somewhat unclear.
Lack of message delta compression: Pusher does not support message delta compression, meaning that each time a message stream is transmitted, the entire payload is sent rather than just the changes.
PubNub pros and cons
Pros of PubNub:
Multi-region solution: Provides globally-distributed infrastructure spanning 15 datacenters, with data replication in multiple regions to protect against single points of failure.
MQTT support: Pusher has MQTT support for constrained bandwidth environments like IoT device networks.
Persisted messaging data: Provided out of the box.
Good security: End-to-end encryption and compliance with standards such as HIPAA, GDPR, SOC 2 Type 2.
Cons of PubNub:
QoS/delivery order/idempotency: PubNub does not guarantee that messages are stored or sent in the exact same order in which they are published. Delivery is not guaranteed either - PubNub’s default message queue size is 100 messages. Publishing more than 100 messages results in older messages getting discarded. In practice, if you publish more than 100 messages while a subscriber goes offline, when they reconnect, they won’t receive the messages that were discarded.
Uses HTTP as the main transport protocol: PubNub transports messages via HTTP long polling, which is not as performant as WebSockets or other transport mechanisms. Bear this in mind as you think about data volume and scalability.
Lack of message delta compression: Related to the general point about performance above, PubNub does not support delta message compression, meaning that each time a message stream is transmitted, the entire payload is sent rather than just the changes.
Pricing transparency: PubNub's pricing follows a usage-based model. However, pricing is based on over 60 different transaction types, making it difficult to predict ongoing costs.
Lack of JWT support: PubNub is not able to use JWTs, an industry standard for authentication.
Firebase pros and cons
Pros of Firebase:
Robust database provision as standard: You get complete database functionality, meaning that you don’t have to use other platforms to provide these.
Robust authentication: Token-based, JWT, and more.
Other features: Firebase also offers other useful features as standard for building apps — hosting, analytics, and more.
Integrations: Given that Firebase is powered by Google, this naturally extends its functionality via integrations with services such as Google Pub/Sub, Google Cloud Functions, and Google Analytics.
No datacenter lock-in: Firebase has 17 global datacenters available, and you can replicate your data across multiple regions, which has advantages for performance, scalability, and availability.
Cloud and in-app messaging: Both Firebase Realtime Database and Cloud Firestore can push realtime updates to client devices following any changes to the database. There’s also Firebase Cloud Messaging, a service that allows you to send native push notifications and notification messages across platforms (iOS, Android, web).
Cons of Firebase:
Connection limits: An instance of the Firebase Realtime Database has a limit of 200,000 concurrent connections and 1,000 write operations per second. To scale beyond these limits, you have to use sharding, which is a notoriously difficult process.
Vendor lock-in: If one day you conclude that the Realtime Database / Cloud Firestore is unsuitable for your use case, it’s hard to migrate to another (NoSQL) database. This is because of the way data is stored — a JSON tree in the case of the Realtime Database, respectively collections of documents (which are very similar to JSON data) in the case of Cloud Firestore.
Potential hidden costs: It is possible for Firebase costs to mount up I you don’t have a good grasp on the pricing model and how to engineer your apps in a cost-effective manner. See How not to get a $30k bill from Firebase for details.
Limited serverless functions: Firebase can only trigger cloud functions for Firebase. It does not support other serverless platforms such as AWS Lambda or Azure Functions.
Pusher vs PubNub vs Firebase: What are the key differences?
The following table summarizes the differences between Pusher, PubNub, and Firebase.
Pusher | PubNub | Firebase | |
Platform type | PaaS | PaaS | BaaS |
SDKs | SDKs offering extensive support across web, desktop, mobile, and IoT. | SDKs offering extensive support across web, desktop, mobile, and IoT. | Official support for web (JS) and native (iOS, Android, C++) platforms. Limited IoT support. |
Cost | Free sandbox for evaluation, up to 200K messages per day and 100 concurrent users. Different pricing tiers after that. | Free to develop, scaling monthly charges based on 60 different transaction types. | The Spark plan is completely free with a hard data limit and limited feature set. The Blaze plan is pay-as-you-go for storage with access to all features. |
SLAs | 99.95% guarantee if you are an enterprise customer | 99.999% guarantee | 99.95% guarantee |
Transport | WebSockets, with HTTP fallback if needed | HTTP long polling, MQTT available | WebSockets to push updates from the database to connected clients |
Supported message format | Text and binary | Text and binary (Base64-encoded) | Text and binary |
Global data centers | 9, single-region usage only | 15, multi-region usage | 17, multi-region usage possible |
Persistent storage | No | Yes | Yes |
Guaranteed message ordering and delivery | No | No | No |
User presence | Yes | Yes | Yes |
Push notifications | Yes, via Beams | Yes | Yes |
WebHooks | Yes | Yes | Yes |
Serverless functions | No | Yes | Limited |
Authentication | Token-based, JWT in certain contexts | Token-based, not JWT | Token and JWT |
Connection recovery with stream continuity | Unknown | Limited up to 100 messages | No |
Should you use Pusher, PubNub or Firebase?
Pusher, PubNub, and Firebase all provide capabilities to facilitate rapid app development and they are managed solutions, so they abstract away the need for you to manage hardware infrastructure yourself. This is exactly what you need if you are planning to develop a realtime app and are time- or resource-constrained.
Which one to choose depends on your exact situation. Pusher and PubNub are both dedicated services for building realtime applications, based on a pub/sub architecture.
PubNub is not based on WebSockets, so suffers in terms of the raw performance that factor brings to Pusher. Pusher might therefore be preferable if you have a large volume of data to transport in realtime.
Pusher, however, has fewer global datacenters available to help with scalability, and it requires you to choose a single datacenter for an app to reside in. This has implications for performance, reliability, and global availability. If this proves to be an issue, PubNub might be a better bet. PubNub also has serverless functions and message persistence out of the box, which Pusher doesn’t.
Firebase is a more general web app solution, which provides more general back-end features, such as databases, analytics, and authentication. It also has the advantage of being part of the Google ecosystem, so it integrates with other Google services. If you are creating a more generic web app with light realtime needs such as statistical updates or open realtime messaging, but you need robust data storage and auth, Firebase might be the better choice.
Pusher, PubNub and Firebase alternatives
There are some use cases where using Pusher, PubNub, or Firebase won’t be a fit - or an alternative could provide greater value. The following articles provide detailed information on the available alternatives for each:
About Ably: An alternative to PubNub, Pusher and Firebase
Ably makes it easy for developers to build and deliver multiplayer collaboration, chat, data synchronization, data broadcast, and notifications at internet scale without the hassle of managing and scaling realtime infrastructure. Ably is underpinned by a globally-distributed, autoscaling edge network.
We provide robust capabilities and guarantees, including 25+ client SDKs targeting every major platform and programming language, feature-rich pub/sub APIs, fault tolerance, and uptime SLAs. Read more about our Four Pillars of Dependability.
Try Ably for free and read our documentation to see how we compare to PubNub, Pusher and Firebase.