Get Advice Icon

Need advice about which tool to choose?Ask the StackShare community!

PubNub
PubNub

124
141
+ 1
227
Pusher
Pusher

337
255
+ 1
213
Add tool

PubNub vs. Pusher - Help me decide


When we talk about adding real-time functionality to our applications, hosted services like Pusher and PubNub easily come to mind given their proven stability and consistency in providing amazing features that enable real-time notifications and messaging infrastructure. Each tool allows you to build apps that allow your users to engage in real-time across mobile, browser, desktop and server.

  • Pusher builds and delivers real-time APIs for app developers building communication and collaboration features.
  • PubNub makes it easy for you to add real-time capabilities to your apps, without worrying about the infrastructure.

In this post, we’ll look deeper into the two technologies and compare their features.

Transport medium

Pusher uses WebSockets and HTTP, and also provides fallbacks for devices that don’t support WebSockets. This makes Pusher an excellent option when considering the real-time effectiveness of the desired application since Websockets allow a long-held single TCP socket connection to be established between the client and the server. This allows for bi-directional, full duplex messages to be distributed instantly with little overhead, resulting in a very low latency connection.

PubNub uses HTTP streaming/long-polling. When building a real-time application with HTTP long polling for server push, you’ll have to develop your own communication management system. This means that you’ll be responsible for updating, maintaining, and scaling your backend infrastructure. With PubNub, you don’t have to worry about all that. PubNub takes care of the backend infrastructure for you, so you don’t have to worry about maintaining and orchestrating your real-time network.

When looking at HTTP long polling with the goal of streaming data, PubNub is a low-latency and low-overhead real-time Web app communication environment, and features the ability to send messages to a single client, client groups and all clients.

Debugging tools

According to this Quora post response by Jeremy Haile, both Pusher and PubNub provide some fantastic debugging tools for developers to aid in development. However, the features are not exactly the same. For instance, with Pusher, you can open up the debug console for your app and watch all of the message throughput.

In addition to the Pusher Debug Console, Pusher also has Event Creator and Channels JavaScript logging that helps you to debug applications and better understand what’s happening in your application during and after development.

In PubNub, you have to type in the exact channel name you want to listen to. Which is fine if your channel name is simple, but is more difficult if your channel name is a long string of random characters.

PubNub docs

PubNub also has a debugging tool called PubNub Functions. Functions is a Python script that monitors all of your event handlers and displays alerts/notifications in the terminal. This is beneficial as you can easily add all of your logs of this system to Elasticsearch via the remote server running the monitor. This will activate services like Kibana, Grafana, and PagerDuty – which in turn covers logging, metrics, and alerts.

PubNub provides structural integrity for applications of any scale, but there could be times where the code within the Function does something you didn’t intend. In such cases, the Functions debugging tool can come in handy to keep tabs on your running PubNub Functions, monitoring their state and health and reporting back any irregularities.

Message size limits

PubNub limits messages to about 1,800 bytes - which may not be enough depending on what you're sending. This could prove problematic when trying to push dynamic data or data from a user entry field. However, PubNub allows you to increase the maximum size to 7.2k for an additional monthly fee.

Pusher limits are 10kb per message as part of their normal offering. However, they offer larger maximum message sizes for enterprise plans compared to PubNub.

Ease of usage

Developers love getting started quickly. Each of these technologies have a well-structured API and documentation that help to make adoption a smooth process.

Getting started with Pusher:

  1. Create a Pusher account and get the API credentials (key, cluster and secret)
  2. Include the channels client library by adding the pusher-js script tag to your page.
<script src="https://js.pusher.com/4.3/pusher.min.js"></script>
  1. Open a connection to Channels using the key and cluster you noted down earlier.
var pusher = new Pusher('APP_KEY, {
      cluster: 'APP_CLUSTER'
      });

  1. Next, you subscribe to a channel - you will soon publish an event to a channel called my-channel, and your web app will receive this event. But to receive this event, your web app first needs to subscribe to the my-channel channel. Do this with pusher.subscribe:
var channel = pusher.subscribe('my-channel');
  1. Listen for events on the channel. Every published event has an “event name”. The event you will publish will have the event name my-event. For your web app to do something when it receives an event called my-event, your web app must first “bind” a function to this event name. Do this using the channel’s bind method:
    channel.bind ('my-event', function(data) {
      alert('An event was triggered with message: ' + data.message);
      });
  1. Finally, trigger events from your server. In the example below, we will trigger an event named my-event to Channels on a channel called my-channel. For this example, we’ll demonstrate with a Node server:
var Pusher = require('pusher');
var pusher = new Pusher({
    appId: 'APP_ID',
    key: 'APP_KEY',
    secret: 'APP_SECRET',
    cluster: 'APP_CLUSTER'
  });
    pusher.trigger('my-channel', 'my-event', {"message": "hello world"});

Getting started with PubNub:

  1. To build an application that leverages the PubNub Data Stream, you need to sign up for your account to obtain API keys.
  2. Install PubNub -To start publishing and subscribing, you first need to access PubNub libraries. Include the code hosted on their CDN just before closing your HTML tag.
<!-- Include the PubNub Library -->
<script src="https://cdn.pubnub.com/sdk/javascript/pubnub.[version number].js"></script>


  1. Now you can instantiate a PubNub object using your own publish and subscribe keys or use the demo keys:
<!-- Instantiate PubNub →

var pubnubDemo = new PubNub({
      publishKey: 'Your Publish Key Here',
      subscribeKey: 'Your Subscribe Key Here'
});
  1. Subscribe - Now that you have PubNub installed and instantiated, subscribe to your own custom data channel and log all sent messages over that channel on the console. To make the channel private, you can use the PubNub Access Manager or use the additional security measures:
// Subscribe to the demo_tutorial channel
pubnubDemo.addListener({
      message: function(message) {
          console.log(message)
      }
  })
pubnubDemo.subscribe({
      channels: ['demo_tutorial']
  });
  1. Publish - After you have subscribed to your own channel, you can then publish your own messages to it:
// Publish a simple message to the demo_tutorial channel
pubnubDemo.publish({
        message: {
            "color" : "blue"
        },
        channel: 'demo_tutorial'
    });
  1. Unsubscribe - After publishing your messages, you can decide to unsubscribe from the channel:
pubnub.unsubscribe({
      channels: ['some_channel']
 });

With those few steps, you can easily get started with both Pusher and PubNub. They both have really simple and efficient API’s that makes them attractive to developers. However, Pusher’s API’s differ in a way such that it offers an additional event abstraction like:

Pusher:

    var pusher = new Pusher(KEY);
    var channel = pusher.subscribe('messages');
    channel.bind('new_message', function(msg) {
    });

PubNub:

    var pubnub = PUBNUB.init({
        subscribe_key : 'demo'
    }) 
    pubnub.subscribe({                                      
        channel : "hello_world",
        message : function(msg){
        }
    })

Pricing

Both Pusher and PubNub offer free plans for developers who want to quickly get started on their services. The major difference in the free and paid plans for both Pusher and PubNub are mostly in the size of messages allowed and how many transactions are available per day. Hence, if you’re building an enterprise application with potentially millions of daily transactions, consider any of the paid plans. However, if you’re building a mini usage app with hundreds or a few thousand messages, the free plans will work conveniently for you.

Pusher docs -pricing

On their free Sandbox plan, Pusher offers:

  • 100 Max Connections
  • Unlimited Channels
  • 200k Messages / Day
  • Limited Support
  • SSL Protection

PubNub’s free plan offers:

Note: Transactions are API requests made to the PubNub network. This includes messages sent and received using Publish and Subscribe APIs.

pubnub docs -pricing

In general terms, the PubNub free plan includes 1M free transactions per month (comprised of any combination of Replicated, Edge, and Function Executions) and 1 GB free Data Persistence per month.

They both offer a paid plan of $49/month with an additional option for a custom plan.

Products

Pusher and PubNub has a wide range of products that make it easy to integrate real-time functionality and other supported features to your apps. We’ll look at their most popular chat products and compare the services they provide.

Pusher ChatKit vs PubNub ChatEngine

Features ChatKit ChatEngine
Read receipts Coming soon
Online user presence
Typing indicators
Webhooks
Chatbot
Chat group capacity 100 Infinite
Muting
Markdown
Rich Media Support Coming soon
Public and private rooms
Language Translation
Cross-platform
Message storage

| More Pusher Products | More PubNub Products | | ----------------------------------------------------------------- -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Channels - Pusher Channels provides real-time communication between servers, apps, and devices. | PubNub DSN - Is a global network infrastructure powering APIs for low-latency real-time messaging to anywhere on Earth. | | Beams - A hosted push notifications API designed for developers who need critical transactional information delivered every time. | Real-time Messaging - This product lets you send and receive cross-platform and cross-device messages with robust yet simple APIs. | | Feeds - Is a product that allows developers build engaging features with an API that instantly delivers updates. | Mobile Push Notifications - Let’s you send APNS and GCM/FCM push notifications combined with real-time messaging for maximum user engagement. | | TextSync - Is a real-time collaborative editor that you can embed into your app in seconds and it’ll let your users collaborate in real-time. | Functions - A PubNub product that provides developers a serverless environment to execute functions on the edge, transforming, enriching, and filtering messages as they route through the PubNub DSN. |

Access Level Control for Websockets and Real-Time Protocols

According to PubNub CTO Stephen Blum on this post, PubNub supports server-side access control. The customer provides PubNub with a token and calls a PubNub API to specify the read/write permissions for that token on one or many channels. The customer then gives that token to the client. PubNub will follow the access control rules for the life of that token. This means that the customer doesn't have to provide authorization servers to ensure access control.

On the other hand, Pusher supports webhooks. Customers provide a REST endpoint to be called whenever a request to Pusher is made. This puts the onus on the customer to develop, maintain, and scale their own authorization servers that must respond in near real-time to calls from Pusher.

Geographic Distribution

PubNub Real-Time Network Every message sent to PubNub is replicated across 14 data centers (including California, Virginia, Ireland, Amsterdam, Sao Paulo, Tokyo, and others). On connection to a PubNub stream, subscribers get automatically routed to their closest data center. It's a bit like a CDN for real-time data. The benefits of this are:

  • Redundancy - across many geographically distributed data centers.
  • *Auto-failover - * If a DC goes down, the users are automatically routed to the next closest data center within seconds, and data they missed during the failover is bundled and sent to them upon reconnection
  • Performance - Users get low latency by always ensuring a minimum distance between them and the closest data center.

Pusher Real-Time Network Pusher is a single data center solution. Pusher does have presence in multiple regions, (Virginia and Ireland), but a customer needs to identify and choose a specific region on which to run their application.

Conclusion

If reaching more users all over the world and delivering extended real-time services is most important to you, then PubNub maybe your better choice here. If however, you’re more interested in fast and efficient message delivery to and from your users with more control over the delivery channels, then Pusher might serve you best.

As always, it's worth evaluating and prototyping with both of them to figure out which service meets your particular needs better.

PubNub vs Pusher: What are the differences?

Developers describe PubNub as "Build real-time apps quickly and scale them globally". PubNub makes it easy for you to add real-time capabilities to your apps, without worrying about the infrastructure. Build apps that allow your users to engage in real-time across mobile, browser, desktop and server. On the other hand, Pusher is detailed as "Hosted APIs to build realtime apps with less code". Pusher is the category leader in delightful APIs for app developers building communication and collaboration features.

PubNub and Pusher belong to "Realtime Backend / API" category of the tech stack.

Some of the features offered by PubNub are:

  • PubNub SDKs support over 50 of the most popular environments, including: iOS, Android, JavaScript, .NET, Java, Ruby, Python, PHP and many more.
  • Data Push - Establish and maintain persistent socket connections to any device (mobile, browser, desktop and server) and push data to global audiences in less than ¼ of a second
  • Presence - Automatically detect when users enter or leave your app and whether machines are online

On the other hand, Pusher provides the following key features:

  • Easily build scalable in-app notifications, chat, realtime graphs, geotracking and more in your web & mobile apps with our hosted pub/sub messaging API.
  • Send programmable push notifications to iOS and Android devices with delivery and open rate tracking built in.
  • Easily add 1-1 and group Chat to your web & mobile apps. Presence, message storage, rich media, notifications, typing indicators and more.

"Massively scalable & easy to use" is the primary reason why developers consider PubNub over the competitors, whereas "An easy way to give customers realtime features" was stated as the key factor in picking Pusher.

Groupon, Buffer, and Mailchimp are some of the popular companies that use Pusher, whereas PubNub is used by PubNub, Balsamiq, and Blossom. Pusher has a broader approval, being mentioned in 124 company stacks & 42 developers stacks; compared to PubNub, which is listed in 43 company stacks and 12 developer stacks.

- No public GitHub repository available -
- No public GitHub repository available -

What is PubNub?

PubNub makes it easy for you to add real-time capabilities to your apps, without worrying about the infrastructure. Build apps that allow your users to engage in real-time across mobile, browser, desktop and server.

What is Pusher?

Pusher is the category leader in delightful APIs for app developers building communication and collaboration features.
Get Advice Icon

Need advice about which tool to choose?Ask the StackShare community!

Why do developers choose PubNub?
Why do developers choose Pusher?

Sign up to add, upvote and see more prosMake informed product decisions

    Be the first to leave a con
      Be the first to leave a con
      What companies use PubNub?
      What companies use Pusher?

      Sign up to get full access to all the companiesMake informed product decisions

      What tools integrate with PubNub?
      What tools integrate with Pusher?

      Sign up to get full access to all the tool integrationsMake informed product decisions

      What are some alternatives to PubNub and Pusher?
      Socket.IO
      It enables real-time bidirectional event-based communication. It works on every platform, browser or device, focusing equally on reliability and speed.
      SendBird
      SendBird is a Messaging SDK, Chat API, and fully managed chat infrastructure for your mobile apps and websites. Embeddable chat for iOS, Android, JavaScript, Unity, .NET.
      Kafka
      Kafka is a distributed, partitioned, replicated commit log service. It provides the functionality of a messaging system, but with a unique design.
      Firebase
      Firebase is a cloud service designed to power real-time, collaborative applications. Simply add the Firebase library to your application to gain access to a shared data structure; any changes you make to that data are automatically synchronized with the Firebase cloud and with other clients within milliseconds.
      Ably
      Ably's APIs solve the most complex and demanding aspects of realtime engineering, making it easy for developers to power and scale realtime apps like chat, multiplayer games, real time GPS location updates, IoT device control, and more.
      See all alternatives
      Decisions about PubNub and Pusher
      PubNub
      PubNub
      Unity
      Unity

      I recently used PubNub to implement a realtime leaderboard into my Unity game. It was easy and straight forward to get up and running. I choose Pubnub because they had a Unity SDK and an example project which showed me how to use it. I downloaded the example project and tweaked it to fit my game.

      In their documentation I found good information about what I needed to know. Also, their support is very helpful when you have questions.

      See more
      PubNub
      PubNub

      I used PubNub because we needed a real time server for our product. Even though we selected a fixed amount paid version, the amount they charged was incredibly high, 8x of the fixed amount. We could not understand how did they do the calculation and there is no easy way of understanding it. Regarding to the analytics they have, we spent millions of messages with few hundred active users.

      Then for the second month we tried to change our architecture to decrease the messages but nothing changed. Then we wanted to get some support from them. We arranged a meeting and the person who joined the meeting didn't even have permissions to see our usage, so it was waste of time. Then they arranged another meeting WEEKS after which didn't solve anything either. As a result, we stopped using it and implemented our own simple pub-sub server.

      See more
      Poojan Shah
      Poojan Shah
      Python Developer at Datavizz · | 6 upvotes · 5.2K views
      PubNub
      PubNub

      I was building up an Alexa Skill in which user orders a meal and its notification gets to the system of the restaurant and gets displayed which was implemented using PubNub which helped me a lot in getting real time updates and notifications. I used simple publish and subscribe module to implement it which resolved a major challenge. The 5 to 6 lines of python code get my every single chain working with notifications. Thanking PubNub for this major support for solving the challenge.

      See more
      Krissanawat Kaewsanmuang
      Krissanawat Kaewsanmuang
      PubNub
      PubNub

      I use PubNub because is simple and easy I use on Chat app this service has stable, cheap and userfriendly. The admin interface is very easy to understand and you will find a lot of tutorials and learning at their website. Pubnub comes with my highest recommendation for anyone working with apps with chat, push notifications and other realtime data.

      See more
      Interest over time
      Reviews of PubNub and Pusher
      Avatar of gdi2290
      Co-Founder and CTO at Tipe
      Review ofPubNubPubNub

      PubNub is my goto solution for when I want to use sockets at scale. They have redundant data centers in 14 regions with 99.999% SLA allowing me to build realtime apps for any platform. Also Stephen (PubNub CTO) is Awesome!

      How developers use PubNub and Pusher
      Avatar of Nathan Heffley
      Nathan Heffley uses PusherPusher

      In the original prototype all the communication was handled by a backend server. Each client connected directly to the server using the socket.io library. This quickly proved to be messy and unreliable, especially on the cheap server being used to host it.

      Websockets proved to be a little more reliable, but still just as messy and not all browsers support them. That's when the project was switched over to use Pusher. Using Pusher has allowed all but the initial connection code to be off-loaded onto the client. Now instead of communicating through a self-hosted server, clients can communicate pretty much peer-to-peer over Pusher.

      Avatar of Volkan Özçelik
      Volkan Özçelik uses PubNubPubNub

      Using websockets is something, scaling a message pipeline to thousands of concurrent connections is something else.

      I trust PubNub with what it does best, and use it as zerotoherojs.com ’s messaging pipeline.

      With PubNub, I have one less problem to think about.

      Avatar of Flutter Health Inc.
      Flutter Health Inc. uses PubNubPubNub

      Flutter uses PubNub for sending push notifications when the users add new posts to the Flutter Community or leave comments.

      Avatar of Jewel Mahanta
      Jewel Mahanta uses PusherPusher

      Pusher is used to send update notification whenever Lapzbot joins a server.

      Avatar of Vamsi Krishna
      Vamsi Krishna uses PusherPusher

      Push real-time updates

      How much does PubNub cost?
      How much does Pusher cost?