Cloudflare Pub/Sub: A Programmable MQTT Message Bus for the Edge
Cloudflare has announced the private beta of Pub/Sub, a programmable message bus built on the MQTT protocol. The service is designed to let developers route, filter, and transform event or telemetry data entirely on Cloudflare's network, before it reaches subscribers.
The core idea is to use Cloudflare Workers as a hook into the message flow. Instead of ferrying data to a single cloud region for processing, Pub/Sub can invoke Worker code at the moment a message is published to the broker. This allows for logic that filters on topic prefixes, parses payloads, and writes metrics or aggregates data—all before broadcasting to any connected clients.
For developers with existing device fleets, the choice of MQTT is significant. The protocol is already spoken by tens of millions of devices, from payment terminals to connected vehicles. By building on an open standard rather than a proprietary protocol, Cloudflare aims to lower the barrier for existing MQTT clients to move to its edge platform. The protocol also brings useful native features including TLS transport encryption, flexible delivery guarantees (QoS), and a scalable topic hierarchy.
A Practical Example: Edge Metrics
To illustrate the programmability, Cloudflare provides an example involving payment terminals reporting transaction data. A Worker subscribes to the message stream and runs a straightforward sequence of operations:
- Filter messages based on a specific topic prefix.
- Parse the payload for a relevant key-value metric.
- Write that metric into Workers Analytics Engine for time-series storage.
This pattern removes the need to stand up a separate metrics service or manage external infrastructure for aggregation. The same code can be adapted for other use cases, such as:
- Using
ctx.waitUntilto asynchronously write raw messages to R2 object storage without blocking delivery. - Rewriting message payloads on-the-fly with data fetched from KV before pushing to subscribers.
- Aggregating messages and POSTing them to legacy on-premises or other-cloud infrastructure via HTTP.
Roadmap and Beta Priorities
During the private beta, Cloudflare is focused on expanding MQTT v5.0 specification coverage to ease migration for existing deployments. Key features on the list include shared subscriptions for load-balancing across multiple subscribers, wildcard subscriptions (single- and multi-tier) for aggregation, and support for Mutual TLS authentication.
Beyond protocol coverage, the developer experience is a major focus. The beta will introduce new pubsub sub-commands to the Wrangler CLI to simplify setup. Cloudflare also plans to build native bindings—similar to how Workers KV operates—to allow Worker code to publish and subscribe directly, without needing a separate client connection. Exploring additional non-MQTT access paths, such as HTTP and WebSockets, is also on the roadmap.
On pricing, Cloudflare is committing to an accessible free tier to encourage experimentation, with specific details to be shared as the beta progresses.
Getting Started
Developers interested in participating can sign up for the private beta access, which is expected to begin rolling out within the next month. In the meantime, the Pub/Sub developer documentation is available for review, covering the underlying architecture, MQTT protocol details, and integration patterns with Workers.



