PubNub describes itself as a “developer platform that powers the realtime infrastructure in apps to build engaging Virtual Spaces where online communities can truly connect”. PubNub provides pub/sub APIs, a managed infrastructure layer, and features such as presence and PubNub Functions to run serverless business logic on messages.
With PubNub, you can build features such as:
Remote IoT control
In-app push notifications
We’ll now look at alternatives to PubNub - similar technologies that allow you to build realtime functionality for end-users. Here are the five alternatives we’ll cover:
Push Technology (Diffusion Data)
DIY WebSocket solution
The Ably serverless WebSocket platform
Pusher provides hosted APIs to build realtime features for end-users. Pusher has two main products:
Channels - pub/sub channels over WebSockets.
Beams - an API for cross-platform push notifications for iOS, Android, and Web.
Pusher primarily uses WebSockets, but will also fall back to HTTP in environments where WebSockets aren’t supported.
SDKs for every major development platform and programming language, giving you the flexibility of integrating Pusher in your preferred language.
Features such as presence (useful, for example, for chat apps), webhooks to capture and respond to client events as they happen, and end-to-end encryption for enhanced security.
No superior QoS messaging guarantees; for example, if a message is published whilst a client is briefly disconnected (such as going through a tunnel or changing networks), then the message published over Pusher will never arrive to that client.
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.)
Pusher requires you to choose a single datacenter for an app to reside in. All realtime traffic must therefore be routed through that single datacenter, regardless of a user’s location. This has implications for performance, reliability, and availability.
DiffusionData (formerly Push Technology) offers a platform that allows you to:
Ingest data from various sources (such as REST APIs and IoT devices).
Transform and segment data in-flight.
Deliver data in realtime to clients (primarily end-user devices) over pub/sub topics.
Note that DiffusionData / Push Technology is available as a cloud offering, but also as an on-prem solution.
DiffusionData (Push Technology) pros
Multi-protocol support: WebSockets & long-polling fallbacks (supported by Diffusion SDKs), MQTT, REST, Kafka (for ingesting data).
Features like delta compression, flow control, and conflation to optimize data distribution in unreliable networks.
DiffusionData (Push Technology) cons
No support for encrypted message payloads (e.g., 256-bit AES encryption).
It’s unclear if the DiffusionData platform guarantees message ordering and delivery. For example, if a client disconnects and reconnects, the documentation doesn’t mention if the stream will resume precisely where it left off, with no messages being lost, delivered multiple times, or sent out of order.
It’s designed to operate in a single region, rather than in a multi-region architecture. This can lead to issues such as increased latency; it may also impact availability (if the region where DiffusionData is deployed experiences downtime, your system would be unavailable to end-users).
WebSocket is a realtime technology that enables bi-directional, full-duplex communication between client and server over a persistent, single-socket connection.
A WebSocket connection starts as an HTTP request/response handshake. If this initial handshake is successful, the client and server have agreed to use the existing TCP connection that was established for the HTTP request as a WebSocket connection. This connection is kept alive for as long as needed (in theory, it can last forever), allowing the server and the client to independently send data at will.
DIY WebSocket solution pros
WebSocket is a mature, widely-used technology; it emerged over a decade ago and has been extensively battle-tested. Most programming languages, development platforms, and browsers support WebSockets.
The WebSocket technology allows for the implementation of application-level protocols (on top of WebSockets), and extensions for additional functionality (such as pub/sub messaging). Building on raw WebSockets means you have the flexibility of designing your own WebSocket-based protocol and capabilities, tailor-made for your specific use case and needs.
Before WebSocket, HTTP techniques like AJAX long polling and Comet were the standard for building realtime apps. Compared to HTTP, WebSocket eliminates the need for a new connection with every request, drastically reducing the size of each message (no HTTP headers). This helps save bandwidth, improves latency, and makes WebSockets less taxing on the server side compared to HTTP.
DIY WebSocket solution cons
Certain environments (such as corporate networks with proxy servers) will block WebSocket connections. You will most likely have to consider supporting fallback transports for these scenarios.
Unlike HTTP, WebSocket is stateful. This can be tricky to handle, because it requires the server layer to keep track of each individual WebSocket connection and maintain state information.
Building a reliable DIY WebSocket solution that you can trust to deliver at scale is expensive, time-consuming, and requires significant engineering effort.
Here are some key stats to give you a taste of how complex it is to engineer WebSocket capabilities in-house:
65% of DIY WebSocket solutions had an outage or significant downtime in the last 12-18 months.
10.2 person-months is the average time to build basic WebSocket infrastructure, with limited scalability, in-house.
Half of all self-built WebSocket solutions require $100K-$200K a year in upkeep.
Created back in 2010, Socket.IO is a well-known open-source library that enables low-latency, bi-directional communication between web clients and servers. Socket.IO is built on top of the WebSocket protocol and provides additional capabilities such as automatic reconnections, or falling back to HTTP long polling.
Multiplexing (namespaces), which enables you to minimize the number of TCP connections used, and broadcast support (rooms), to more efficiently distribute data to clients.
Disconnection detection (configurable Ping/Pong heartbeat mechanism) and automatic reconnections.
Integrations with various solutions for horizontal scaling: Redis, MongoDB, Postgres, AMQP / RabbitMQ. Note that you have to use one of these when you scale beyond a single Socket.IO server, to pass events between nodes, and ensure that events are properly routed to all clients.
No strong message ordering guarantees, especially when the long polling transport is used.
Limited native security features - for example, Socket.IO doesn't provide end-to-end encryption, and it doesn't offer a mechanism to generate and renew tokens for authentication.
Designed to work in a single region, rather than a multi-region architecture. This can lead to issues such as increased latency (if you have users in different parts of the world), and system downtime - what happens if the datacenter/region where you have your Socket.IO servers goes through an outage?
Ably is a serverless WebSocket platform designed for last-mile pub/sub messaging. Ably makes it easy for developers to build realtime experiences like chat, live dashboards, and asset tracking for millions of users, without the hassle of managing and scaling infrastructure.
Key Ably features and capabilities
Ably is underpinned by a globally-distributed, autoscaling network consisting of 16 datacenters and 307 edge acceleration points of presence.
Client SDKs for every major programming language and development platform.
Pub/sub APIs with rich features, such as message delta compression, multi-protocol support (WebSockets, MQTT, Server-Sent Events), automatic reconnections with continuity, presence, and message history.
Guaranteed message ordering and delivery.
Global fault tolerance and a 99.999% uptime SLA.
< 65ms round-trip latency for 99th percentile.
Elastic scalability to handle millions of concurrent clients.
5 solutions you can use instead of SignalR to develop live and collaborative features like chat, multi-user whiteboards, and live dashboards.
Read about 5 Pusher alternatives for developing functionality like live chat, realtime location tracking, activity feeds, and realtime charts and graphs.
Discover Socket.IO alternatives for engineering realtime features and apps like chat, multiplayer games, or live polls and quizzes.