Why Stream is the Best Alternative to PubNub Chat

Emily R.
Emily R.
Published December 13, 2019 Updated January 24, 2023

Launching your in-app chat feature is critical for user conversion, engagement, retention, and satisfaction, which means choosing the right provider to build it for you is just as important. Stream and PubNub are two major options in the in-app messaging space, so you might compare the two chat API providers when evaluating solutions. Here, we analyze both chat offerings.

PubNub

PubNub is an enterprise-grade, lower-level pub/sub solution (hence the name PubNub) to create apps. You'll find that their bigger customers use their real-time API and not their chat API, which they launched in 2019. PubNub Chat does not provide reusable visual components for front-end development, so you must build out most of your chat features if you go with PubNub's product.

While they support low-level SDKs in JS, Swift, Kotlin, and Unity, PubNub Chat is a more expensive option for less complete and feature-rich SDKs compared to other alternatives in the market. Component libraries are available for React and React Native, with iOS and Android unsupported by PubNub but still available for community contributions.

As an RTI provider, PubNub's feature set is limited compared to Stream and other alternatives and lacks many of the chat components that modern app users expect. PubNub does not support custom attachments, multi-tenancy, messaging threads, attachments, offline storage, and other common features.

Its message reactions require additional API calls, and you must provide your emoji library; there is no multi-tenancy support or Edge API Infrastructure like Stream has.

PubNub’s moderation offering for chat is also rudimentary; users can flag or report messages, but that's about it. Stream’s advanced and AI-powered moderation is a much more robust solution.

PubNub also limits public and group channels at the product level for typing indicators, invites, and read receipts. Stream allows customers to define custom channel types where they can decide to turn these on or off; it's not a limitation we dictate to our customers.

It's true when you hear that PubNub has an excellent track record of performance, scalability, and reliability. But, it is more so for their real-time API, which uses a very old protocol called "long-polling" versus web sockets and is prone to higher latency rather than their chat solution.

Stream

Stream's chat API and chat SDKs are the most performant solutions today. The enterprise-grade cloud components make it easy for software teams to add a complete in-app chat experience to their products without reinventing the wheel — saving time, money, and resources to focus on their core competencies.

Stream's scalable APIs and SDKs come with all the building blocks to ship a custom white-label experience that rivals today's leading social platforms, serving over a billion end users. Stream's back-end infrastructure, customizable UI kits, and front-end SDKs combine to form the fastest, most reliable, and feature-rich component solution.

Component libraries are available for:

  1. Android (Jetpack Compose)
  2. iOS, (SwiftUI)
  3. Web (React, Angular, JS)
  4. React Native
  5. Flutter
  6. Gaming (Unreal or Unity)

The UI kit comes with customizable UI components for the four most common chat/messaging use cases to simplify designing your app. You can easily and quickly craft a beautiful chat app with Stream's high-quality UI kit for Sketch, Figma, and Adobe XD. Interfaces for the following use cases are included:

  • Social Chat
  • Team Collaboration
  • Live Streaming
  • Video Games

Selecting the use case will modify your chat settings depending on which one you choose. For example, choosing the Live Streaming use case will turn off typing indicators and read status since the volume of messages will likely be high. You can check out Stream's UI kit in the live demos to see the difference between these use cases.

Stream vs PubNub

Stream's Strengths as a PubNub Alternative

  • Stream has front-end component libraries for Android, iOS, React, React Native, Flutter, Angular, Unity, Unreal, and JS. PubNub only has component libraries for Android, iOS, and React, which are much more rudimentary than Stream's.

  • Stream offers a UI kit with customizable interfaces for different use cases in both light and dark modes. PubNub does not provide any reusable visual components.

  • Stream has UI components for Android Compose and SwiftUI. Google and Apple are pushing for these frameworks to be the leading way to build mobile applications in the future.

  • Stream's front-end components include built-in support for unread counts, connection recovery, message states, and read events. You can build those features on top of PubNub's API yourself, but it's easy to make mistakes, especially if you're under a tight deadline, costing you more time and resources.

  • Stream helps you ship in-app chat messaging with all of the features users expect, including message reactions, thread replies, slash commands, unread count, and attachments — which PubNub doesn't offer right out of the box.

  • Stream provides edge servers for chat, reducing latency and timeout errors when connected with Stream compared to PubNub. PubNub offers an edge API infrastructure for their real-time API, but not one for their chat solution like Stream does.

  • Stream's chat API enables you to create channel types that give you complete control over permissions and features, providing the flexibility that PubNub lacks. Channel types allow you to configure your detailed permissions and enable/disable features such as link sharing, read indicators, typing indicators, etc.

  • Stream Chat offers Advanced Chat Moderation with automatic message flagging and blocking as well as AI-powered AutoModeration, whereas other in-app chat providers like PubNub require the addition of a costly third-party moderation tool to achieve similar results.

  • PubNub's pricing is confusing, and very difficult to estimate what you'll be paying. PubNub's pricing is not built around their chat offering — it's built around being a low-level pub/sub-framework.

The UI kit comes with customizable UI components for the four most common chat/messaging use cases to make designing your app simple. You can easily and quickly craft a beautiful chat app with Stream’s high-quality UI kit for Sketch, Figma, and Adobe XD. Interfaces for the following use cases are included:

  • Social Chat
  • Team Collaboration
  • Live Streaming
  • Video Games

Selecting the use case will modify your chat settings depending on which one you choose. For example, choosing the Live Streaming use case will turn off typing indicators and read status since the volume of messages will likely be high. You can check out Stream’s UI kit in the live demos to see the difference between these use cases.

Stream vs PubNub 1

Stream powers activity feeds and chat for over a billion end users. The technology is based on Go, RocksDB & Raft. This tech stack is similar to what Google, Instagram, and LinkedIn use. The APIs typically respond in 20ms, and they offer a 99.999% uptime SLA on enterprise plans.

Here is a review of PubNub’s messaging features compared to Stream’s:
FeatureStreamPubNub
1:1 MessagingYesYes
Group MessagingYesYes
Channel MessagingYesYes
@mentionsYesYes
SearchYesYes
Pinned MessagesYesNo
Custom ObjectsYesYes
Custom User and Channel EventsYesNo
Slash CommandsYesYes
FunctionsNoYes
Rich URL PreviewYesNo
Typing IndicatorsYesYes
Message attachments and actionsYesYes
Read receiptsYesYes
Unread Message CountsYesYes
Delivered IndicatorsYesYes
Online User PresenceYesYes
User to User MuteYesYes
User to User BlockYesYes
Offline SupportYesNo
Custom MetadataYesYes
ReactionsYesYes
Threads and RepliesYesNo
User InvitesYesYes
Video PlaybackYesYes
File UploadsYesYes
Custom rolesYesNo
GiphyYesYes
Push NotificationsYesYes
EmoticonsYesYes
TranslationsYesYes
Multi Tenant APIYesNo
Scalability for Live EventsYesUnknown
AI Text ModerationYesVia a partner
AI Image ModerationYesYes
Moderation Ban UserYesYes
Moderation DashboardYesYes
Slow ModeYesYes
Announcement APIYesNo
ReactYesYes
React NativeYesUI Component Only
FlutterYesClient SDK Only
iOSYesClient SDK Only
AndroidYesClient SDK Only
UnityYesClient SDK Only
UnrealYesNo
AngularYesNo
SwiftUIYesNo
Jetpack ComposeYesNo
Livestream Traffic Feature SwitchesYesNo
Security ComplianceYesYes
GDPR-friendly API endpointsYesYes
Customer SupportYesYes

Security and Compliance

Building your own app? Get early access to our Livestream or Video Calling API and launch in days!

Stream completed its SOC 2 Type II and ISO 27001 audits, achieving compliance with the organization's rigorous security standards. The certifications verify Stream's dedication to providing a highly secure in-app chat solution to enterprise customers and the company's existing HIPAA and General Data Protection Regulation (GDPR) compliance.

These security certifications mean users can rest assured that their data is protected during processing — no small thing in today's technologically-run world. These compliance achievements give Stream's users even more confidence in how Stream manages real-time data globally. Our customers trust their in-app chat providers by outsourcing their chat development so that they can focus on activities that are more core to their business, so it's important to prioritize transparency.

PubNub's SOC 2 compliance is for U.S.-based customers only. It is difficult to fully trust an in-app chat provider without valuable insights into their organization's risk and security posture, vendor management, internal controls governance, and regulatory oversight that can then be shared with a company's user base. By completing these audits, customers can safely rely on a third party's real-time system, network, and infrastructure.

Stream vs. PubNub Code-Level Comparison

Ultimately, a chat SDK must always be integrated into an existing product. We want to take a quick look at each provider and highlight key differences.

For this example, we look at both providers' React SDKs. We chose this platform because it is the only one where PubNub has a UI components library available. No officially supported UI component libraries are available for iOS and Android from PubNub. While community-supported component libraries are available for iOS and Android, at the time of this writing, these have yet to see any updates in the past eight months.

Stream has fully supported UI Component libraries for React, React Native, iOS, Android, Flutter, Angular, Unreal, and Unity. First, we want to show that creating a basic starting application is similar for both SDKs.

Here is a fully working example for the Stream SDK:

tsx
import 'stream-chat-react/dist/css/v2/index.css';

const user: User = {
  id: 'lively-bird-4',
  name: 'lively-bird-4'e,
  image: `https://getstream.io/random_png/?id=${userId}&name=${userName}`,
};

const apiKey = '<your-api-key>';
const userToken = '<your-user-token>;

const chatClient = new StreamChat(apiKey);
chatClient.connectUser(user, userToken);

const channel = chatClient.channel('messaging', 'custom_channel_id', {

And, as a comparison, a fully-working PubNub example:

tsx
import React from "react";
import PubNub from "pubnub";
import { PubNubProvider } from "pubnub-react";
import { Chat, MessageList, MessageInput } from "@pubnub/react-chat-components";

const pubnub = new PubNub({
  publishKey: "myPublishKey",
  subscribeKey: "mySubscribeKey",
  userId: "myFirstUser",
});
const currentChannel = "Default";
const theme = "light";

function App(): JSX.Element {
  return (

While these are interesting, integration requires much more than just the most basic example possible.

Both SDKs offer built-in React UI components that can be used and put into any system and just work. However, in most cases and for most products, a certain level of customization is necessary to fit into the brand and look and feel.

Here, we can see differences. Basic customization is something that both SDKs offer: having general themes, such as light and dark mode, and minor color adjustments (in this case, using CSS variables) are supported on both platforms.

The differences start occurring when we look at more advanced customization options that are a common necessity when integrating. Customizing specific components, such as the appearance of a message, requires the framework to allow for easy access to necessary properties and freedom to display them however we like.

This is where we can see differences in the SDKs. While PubNub only offers a very basic explanation of how this can be done, Stream gives plenty of examples and how-to guides with step-by-step instructions.

Sticking to the example of the custom message UI, there is a detailed guide with all the properties we can use and easily access to tailor the UI to the product we want to build. This is true for many other components as well.

To demonstrate this in more detail, we look at the Typing Indicator, a very common feature in chat applications. While PubNub offers a general component to add this, there are no customization options.

In the Stream SDK, there is a detailed guide on how to write a custom typing indicator, with an explanation of the properties to access from the SDK for easy focus on being productive and putting something out quickly.

Here is an example of how the code for that would look like:

tsx
export const CustomTypingIndicator = (props: TypingIndicatorProps) => {
  const { threadList } = props;

  const { channelConfig, thread } = useChannelStateContext();
  const { client } = useChatContext();
  const { typing = {} } = useTypingContext();

  if (channelConfig?.typing_events === false) {
    return null;
  }

  const typingInChannel = !threadList
    ? Object.values(typing).filter(
        ({ parent_id, user }) => user?.id !== client.user?.id && !parent_id,
      )

While the basics of the SDKs look very similar, the PubNub SDK offers limited customization. The Stream SDK allows for several different customization options that are well-documented to allow developers to get up and running quickly while giving them the freedom to customize the experience of their product and brand easily.

Simple Migration

Stream can work with you painlessly and seamlessly migrate from PubNub to Stream. With our import tools and customizable interfaces, we can help you transition your platform from PubNub to Stream Chat in minimal time.

Companies typically switch to Stream either from an in-house built messaging solution or from a different third-party chat API because of our:

  • Scalability
  • Performance
  • Stability
  • Advanced features
  • Security
  • Customizable front-end components

Try Stream For Free

Want to see how easy it is to migrate from PubNub Chat to Stream? It only takes about 60 seconds to sign up for an account or reach out, and we'll be happy to help you run a test yourself.

Want to jump right into the code? No problem. We also have an interactive API tour—no login required!

Happy chatting!

decorative lines
Integrating Video With Your App?
We've built an audio and video solution just for you. Launch in days with our new APIs & SDKs!
Check out the BETA!