The best PubNub alternative is the one whose billing unit matches how your traffic grows and whose hosting model matches your team. Pick a hosted realtime API such as Ably or Pusher if you don't want to run servers, a self-hosted server such as Centrifugo if you do, or collaboration infrastructure such as Liveblocks if your users edit shared data together.
People leave PubNub for different reasons. Some want to host the messaging layer themselves, some have moved deeper into one cloud, and some have found that what they're building is really shared, editable state rather than a stream of messages. Each reason points somewhere different, so this page spends most of its words on the choice and keeps the list itself short.
Know what you're moving off
PubNub's pricing page says it bills on one metric, monthly active users, and that every plan includes unlimited channels and all its core features. The free plan is pitched for testing and prototypes, with a cap on monthly active users or transactions. So whatever you move to, you're swapping a per-user meter for a different one, and the bill will behave differently as soon as your traffic does.
Before you look at a single alternative, list which PubNub features your app calls today. The usual four are Presence (online and offline events plus occupancy counts per channel), Message Persistence (stored history so a device that was offline can fetch what it missed), Access Manager (token-based permissions for who can read or write each channel) and mobile push fallback to APNS and FCM. Every one you use needs an equivalent on the new service, or a plan for building it, before you write any migration code.
The meter matters more than the headline price
Every hosted realtime service charges you for something, and the something varies wildly. Some count monthly active users. Some cap the messages and concurrent connections you get each day, and you climb through tiers as you hit them. Microsoft's service bills capacity in units per day, with each paid unit holding a fixed number of connections. Google's database charges for gigabytes stored and gigabytes downloaded. Collaboration platforms tend to sell monthly credits that drain as people connect and edit. PubNub's own meter is the per-user kind.
The same app produces very different bills on different meters. A per-user meter grows steadily as your audience grows and barely notices a busy evening. A daily message cap doesn't care how many people you have, but one big live event can blow straight through it. A bandwidth meter punishes chunky payloads: on Azure, a message over 2 KB counts as several messages, and a million messages works out at roughly 2 GB of outbound traffic. If your messages carry whole objects rather than small deltas, that line deserves a hard look.
So before you compare features, pull three numbers from your current dashboard: peak concurrent connections, monthly active users and messages per day at your busiest. Those three numbers will tell you more about which alternative you can afford than any feature grid.
Hosted, self-run, or something in between
This is the fork that cuts the field in half. Hosted APIs mean someone else keeps the servers alive at three in the morning. You trade control and some cost for not owning uptime, upgrades and monitoring. Moving from one hosted network to another is also the closest thing to a like-for-like swap, because the client code looks broadly similar.
Self-run servers flip the deal. The open-source options here cost nothing to license, and that's real money saved at scale. But free to license isn't free to run. You pay in servers, in someone being on call, and in the hours spent on scaling, reconnection and history that a hosted service handled quietly. A typical self-run server speaks several transports at once, WebSocket, server-sent events and HTTP streaming among them, and every one of those is something your team now keeps patched, monitored and scaled.
In between sit two options worth knowing. A library such as Socket.IO gives you the messaging pattern inside your own app code, but you host and scale it, using adapters once you need more than one server. And Mercure offers both routes: run its hub yourself, or use its cloud, which is hosted in Amsterdam under French jurisdiction. That matters if your legal team cares where data sits.
My view: if you've got fewer than a couple of engineers and nobody who wants a pager, stay hosted and pick the meter that suits your traffic. The hosted options built for live messaging are compared in a separate list of realtime chat APIs. If you already run infrastructure well, self-hosting removes a licence line from the budget, and that saving is the main reason to take the ops work on.
Messages or shared state?
A lot of realtime work isn't really messaging. If people are editing the same document, board or canvas at once, a pub/sub layer leaves you writing conflict handling yourself, and that's a hard problem to get right. Collaboration infrastructure built on CRDT data handles concurrent edits for you and adds presence and comments on top. If your roadmap includes AI agents editing alongside people, that's the category to look at.
At the other end, if your app is mostly alerting people who aren't even in it, you may not need a realtime network at all. My guide to the best push notification services covers that job, and it's worth ruling out before you take on a bigger migration than you need.
What has shifted this year
Two things to note. PartyKit's hosted platform, once a popular pick for this kind of work, now says it shut down in October 2026. And Firebase has new pricing for some of its products taking effect from 1 September 2026. The lesson is the same in both cases: read a tool's own homepage and pricing page today, not a comparison from last year, and make sure the version you're planning on still exists in the form you expect.
Nine options worth a look
Ably
A hosted realtime platform for chat, messaging, live collaboration and AI features, for teams that want message delivery handled without running servers of their own.
Azure Web PubSub
Microsoft's fully managed service for realtime web messaging, the natural candidate when your app, identity and logging already live inside Azure.
Centrifugo
An open-source messaging server you host yourself, publishing through an API and holding client connections over WebSocket, SSE, HTTP-streaming, WebTransport or gRPC.
Firebase Realtime Database
Google's cloud-hosted JSON database that pushes changes to every connected client, suited to apps where the data itself has to stay in sync.
Liveblocks
Collaboration infrastructure for presence, comments and shared documents that several people, or AI agents, edit at the same moment.
Want AI doing the heavy lifting in your marketing?
I build the systems that handle the boring 80 percent, so you get your week back. Done properly, with the human kept in.
Mercure
An open protocol and MIT-licensed hub for pushing server-sent updates to browsers over plain HTTP, run on your own machines or in its EU cloud.
Pusher
Hosted channels for pub/sub messaging, aimed at live dashboards, notifications, geotracking and chat in web and mobile apps.
Socket.IO
A library rather than a service: event-based, two-way messaging between browser and server, falling back to HTTP long-polling when WebSocket can't connect.
Stream
Ready-made APIs and SDKs for in-app chat, video calling, livestreaming, activity feeds and moderation, for products where chat is a feature in its own right.
What the category costs, roughly
Almost every hosted option has a free allowance, and almost every free allowance is small. Several stop at around 100 concurrent connections, which is fine for building and testing and nowhere near enough to launch on. Entry paid plans for general realtime messaging tend to sit somewhere between about $25 and $50 a month. Full chat and video suites start much higher, in the hundreds a month billed annually, because you're buying finished features rather than plumbing. Enterprise tiers are almost always quote-only.
Self-hosted servers and libraries cost nothing to license, though commercial add-on licences, where they exist, are usually priced on request. Budget for the servers and the people instead.
A one-hour test before you commit
Pick two candidates from the same branch of the fork, so you're comparing like with like, and sign up for their free allowances. Then do this:
Take one low-risk channel, such as a typing indicator or an internal dashboard. Publish 1,000 messages at about 20 a second to two subscribers on each service. Halfway through, switch off the network on one subscriber for 30 seconds, then switch it back on. Count what arrived, what arrived out of order and what was missing, and check whether history let the client catch up.
Then spend the last 15 minutes on the paperwork. Take the PubNub feature list you wrote earlier and map how presence, history and auth tokens work on each, because those are the parts that differ most from one tool to the next and the parts that bite during a migration. Finally, plug your three numbers from earlier into each pricing page and write down the monthly cost at your current peak and at double it.
By the end of the hour you'll have a reconnect result, an auth plan and two cost figures. That's a better basis for a decision than any feature table.
Running the switchover
Don't switch off your PubNub keys early. Realtime problems show up under real traffic, on flaky mobile connections and at odd hours, so run old and new side by side until the new service has carried real users through a few busy days without surprises.
And don't choose on SDK feel alone: a pleasant API with the wrong meter will cost you far more than a slightly clunkier one that bills the way your app behaves.
The costliest shortcut is moving a collaborative editing feature onto plain pub/sub and planning to handle conflicts later. Later tends to arrive as a support queue full of lost edits.
Which type to choose
For a small team that wants the nearest swap, choose a hosted realtime API and pick the meter that fits your growth. If you're already committed to one cloud, start with that provider's managed service and its own database sync. If you've got ops capacity and serious volume, a self-hosted server or a library removes the licence bill. And if people edit shared data together, go straight to collaboration infrastructure rather than rebuilding it on messages.
Do you make a realtime messaging API, server or library? Tool makers can ask to be considered for a featured place on this list.
Want your tool on this list? Featured spots and reviews here are paid partnerships. Here's how to partner with me.