Pub/Sub pricing

How Pub/Sub operations contribute to your message count and strategies to optimize costs.

Pub/Sub operations contribute to your message count based on publishing, delivery, and optional features like persistence and presence.

Pub/Sub operations

The following table shows how Pub/Sub operations contribute to your message count:

OperationMessages counted
Messages
Publish1 inbound message
Message delivery1 outbound message per subscriber
Presence
Presence enter1 inbound message
Presence leave1 inbound message
Presence update1 inbound message
Presence event delivery1 outbound message per presence subscriber
Presence REST query1 outbound message per member returned
Batch presence request1 outbound message per member across all queried channels
Storage and history
Persistence storage1 additional message per stored message
History retrieval1 outbound message per retrieved message
Rewind on attach1 outbound message per rewound message (up to 100)
Integrations
Integration delivery1 outbound message per integration target
Inbound integration publish1 inbound message
Push notifications
Push notification delivery1 outbound message per delivered notification
Annotations
Annotation publish1 inbound message
Annotation delete1 inbound message
Annotation summary delivery1 outbound message per subscriber; multiple annotations may be rolled up into a single summary
Metadata and stats
Lifecycle event ([meta]connection.lifecycle, [meta]channel.lifecycle)1 outbound message per event
[meta]stats:minute event1 outbound message per event
[meta]log subscriptionNot counted

Channels

Channels are the unit of message distribution. Each channel you use contributes to your channel count. Ably includes channels with each package and charges for additional channels beyond the included allowance.

Connections

Ably bills each connected client for connection minutes. A connection-minute is counted for every minute a client maintains an open connection, regardless of activity. Clients that remain connected but idle still accrue connection minutes.

Cost optimization

Use ephemeral messages

Mark messages as ephemeral to exempt them from persistence, rewind, resume, and integrations. Use this for streaming data where history is not needed.

Disable self-delivery

Set echoMessages: false to prevent messages from being delivered back to the publisher. This is useful for optimistic UI patterns and server-side publishers.

Enable conflation

Conflation delivers only the latest message per key in each time window. Use this for high-frequency updates where only the latest value matters.

Use server-side batching

Server-side batching groups messages into single deliveries. Use this for high-throughput channels where slight delay is acceptable.

Enable delta compression

Delta compression reduces payload size, lowering bandwidth costs. Use this for large, structurally similar successive messages.

Use occupancy instead of presence

Use occupancy instead of presence when you only need member counts, not individual identities. This avoids the n-squared presence event fan-out where each member event is delivered to every subscriber. For example, 200 members joining and leaving a channel generates approximately 80,400 messages. See large-scale presence sets for the full calculation.

Enable server-side presence batching

Enable server-side batching to group presence events and support up to 20,000 members per channel. Subscribe to presence updates only on channels where you need member-level detail.