PubNub API
PubNub provides a globally distributed publish/subscribe API for real-time data streaming, presence detection, message persistence, and push notification delivery across web, mobile, and IoT devices — accessible via REST and WebSocket.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
PubNub Access Manager provides channel-level and user-level permissions with signed tokens. Secret key must be kept server-side only. TLS is enforced for all API connections. Cipher-key based AES-256 message encryption is available client-side for end-to-end encrypted channels.
⚡ Reliability
Best When
An agent needs to broadcast real-time events to many connected clients simultaneously, or ingest live data streams from distributed sources like IoT devices or user activity feeds.
Avoid When
You need guaranteed exactly-once delivery, message ordering across channels, or processing backpressure — PubNub's at-least-once semantics and lack of consumer group coordination make these difficult.
Use Cases
- • Publish real-time status updates or events to subscribed clients from an agent processing backend events
- • Subscribe to channels to receive live data streams (IoT sensor readings, user activity events) for agent processing
- • Query message history from a channel to reconstruct state or catch up on missed events after an agent restart
- • Use presence APIs to determine which users or devices are currently connected before sending targeted messages
- • Send mobile push notifications (APNs, FCM) via PubNub's push gateway as part of a multi-channel notification workflow
Not For
- • Persistent message queue semantics with consumer groups and guaranteed delivery — PubNub is a pub/sub bus, not a durable message queue
- • Large payload transfer — PubNub messages are limited to 32KB; use object storage for large data with PubNub signaling the availability
- • Complex stream processing, aggregation, or windowing — a dedicated stream processor (Kafka Streams, Flink) is more appropriate for analytics pipelines
Interface
Authentication
All API calls require a publish key and subscribe key pair issued per application. PubNub Access Manager (PAM) provides token-based fine-grained permissions on channels and user IDs with TTL. Subscribe-only operations use the subscribe key alone. REST calls include keys as query parameters.
Pricing
Free Sandbox plan is suitable for development and small-scale production. Pricing scales with transaction volume; presence and persistence add-ons cost extra on paid plans.
Agent Metadata
Known Gotchas
- ⚠ Publish and subscribe keys are different — using the wrong key for an operation (e.g., using subscribe key to publish) returns a non-obvious auth error
- ⚠ PubNub Access Manager tokens must be generated server-side and refreshed before TTL expiry — clients with expired tokens are silently disconnected from protected channels
- ⚠ Message history requires the Storage and Playback add-on to be enabled per key set in the dashboard — history queries on keys without persistence return empty results without a clear error
- ⚠ The REST subscribe API uses long-polling by default (not WebSocket) — agents using the REST API will hold connections open for up to 5 minutes; SDK-based subscriptions use WebSocket automatically
- ⚠ Channel group limits (2000 channels per group, 10 groups per subscribe) can be hit by agents managing many data streams; exceeding limits causes silent filtering of channel events
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for PubNub API.
Scores are editorial opinions as of 2026-03-06.