Should I use Socket.IO or PubNub

Jude Agboola
Charisol Community
Published in
3 min readSep 23, 2019


Recently, I tried so I decided to share my thoughts while comparing it with PubNub.

Photo by Veri Ivanova on Unsplash

It’s quite normal to get confused about what technology to use for a project especially when the technologies are functionally equivalent. Understanding the strength and weakness of one tech in relation to the other may help you make better decisions.

I’ve used PubNub in a number of projects, One is a slim WhatsApp group clone that I recently open-sourced. Yeah, it’s one of those fun projects take a look. The code is available on Github.

WhatsApp group clone with PubNub

Let’s dive right into the key differences between these technologies!


PubNub provides realtime messaging-as-a-service. This means you’ll never have to manage your own server to do real-time stuff in your application. They also provide APIs for more specific use-cases like chats. It’s quite easy to get started with PubNub, you just need to sign up, grab the SDK and plug it into your code. With PubNub you can send a message (PUBLISH) as large as 32KB to any client application sitting anywhere in the world within 1/4 of a second, but usually much faster (30–40ms). The network has multiple points of presence on every inhabited continent, allowing messages to be sent using the shortest network path, for the lowest latency.

PubNub is already built for scale, you don’t need to worry about load balancing or creating a resiliency layer with Redis, your message is guaranteed to get delivered as fast as possible no matter where the sender/receiver is in the world! It also sparks joy that an increase in your customer base wouldn't lead to failure or increased latency since PubNub is actually built for this. PubNub Removes the need for a server back-end so you can focus on building your apps. is a NodeJS library that powers real-time applications. It’s also fairly easy to get started with only that the publish/subscribe model from PubNub stuck better with me 😜. also has a client library that would be needed to connect to the server (since you’ll be managing one). Socket.IO allows you to emit and receive custom events. It has reserved events like connect, message, disconnect, reconnect, ping, join and leave which are all internally controlled.

With you’ll have set up a NodeJS server, install, handle load balancing to make sure your application is ready to scale. Generally, you’ll have to do a lot of orchestration, especially in a multitenant space. And hey you just have to make sure you’re doing things the right way.

Code Sample

For demonstration, I built a very simple group chat app with each these technologies. You will need to sign for PubNub and add your API keys for the PubNub example to work :)

PubNub group chat example

here is the example client

The server


  • It’s quite easier to manage users in a multitenant space with PubNub.
  • PubNub is already built for scale, just write your code and forget about servers. Think about PubNub as real-time without the server clusters.
  • PubNub zero-in-on more specific use-cases that you may not find in

Thanks for reading!



Jude Agboola
Charisol Community

Software Engineer • Occasionally write about software and anything that excites me.