Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/data/nav/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ export default {
},
],
},
{
name: 'Chat pricing',
link: '/docs/chat/pricing',
},
{
name: 'Guides',
pages: [
Expand Down
9 changes: 4 additions & 5 deletions src/data/nav/liveobjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ export default {
link: '/docs/liveobjects/concepts/synchronization',
languages: ['javascript', 'swift', 'java'],
},
{
name: 'Billing',
link: '/docs/liveobjects/concepts/billing',
languages: ['javascript', 'swift', 'java'],
},
],
},
{
Expand Down Expand Up @@ -104,6 +99,10 @@ export default {
},
],
},
{
name: 'LiveObjects pricing',
link: '/docs/liveobjects/pricing',
},
],
api: [
{
Expand Down
4 changes: 4 additions & 0 deletions src/data/nav/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ export default {
link: '/docs/platform/pricing/billing',
name: 'Billing',
},
{
link: '/docs/platform/pricing/message-counting',
name: 'Message counting',
},
{
link: '/docs/platform/pricing/limits',
name: 'Limits',
Expand Down
4 changes: 4 additions & 0 deletions src/data/nav/pubsub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,10 @@ export default {
},
],
},
{
name: 'Pub/Sub pricing',
link: '/docs/pub-sub/pricing',
},
{
name: 'Guides',
pages: [
Expand Down
4 changes: 4 additions & 0 deletions src/data/nav/spaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ export default {
},
],
},
{
name: 'Spaces pricing',
link: '/docs/spaces/pricing',
},
],
api: [
{
Expand Down
69 changes: 69 additions & 0 deletions src/pages/docs/chat/pricing.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
title: "Chat pricing"
meta_description: "Understand how Chat SDK features contribute to your message count, including messages, typing indicators, reactions, and cost optimization strategies."
meta_keywords: "chat pricing, message counting, typing indicators, reactions, cost optimization"
intro: "How Chat SDK features contribute to your message count and strategies to optimize costs."
redirect_from:
- /docs/chat/message-billing
---

The [Chat SDK](/docs/chat) is built on top of [Pub/Sub](/docs/pub-sub). All Chat operations generate Pub/Sub messages that follow the same counting rules.

<Aside data-type="further-reading">
For how all Ably products count messages, see [message counting](/docs/platform/pricing/message-counting). For package comparison and volume discounts, see the [pricing](https://ably.com/pricing) page.
</Aside>

## Chat operations <a id="operations"/>

The following table shows how Chat operations contribute to your message count:

| Operation | Messages counted |
| --- | --- |
| [Send message](/docs/chat/rooms/messages) | 1 inbound message |
| Message delivery | 1 outbound message per subscriber |
| [Update message](/docs/chat/rooms/messages#update) | 1 inbound message |
| Message update delivery | 1 outbound message per subscriber |
| [Delete message](/docs/chat/rooms/messages#delete) | 1 inbound message |
| Message deletion delivery | 1 outbound message per subscriber |
| [History](/docs/chat/rooms/history) retrieval | 1 message per retrieved message |
| [Typing indicator](/docs/chat/rooms/typing) keystroke | 1 inbound message; repeats every heartbeat interval (default 10s) |
| Typing indicator delivery | 1 outbound message per subscriber per heartbeat |
| [Typing indicator](/docs/chat/rooms/typing) stop | 1 inbound message |
| Typing stop delivery | 1 outbound message per subscriber |
| [Room reaction](/docs/chat/rooms/reactions) | 1 inbound message |
| Room reaction delivery | 1 outbound message per subscriber |
| [Message reaction](/docs/chat/rooms/message-reactions) send | 1 inbound message |
| [Message reaction](/docs/chat/rooms/message-reactions) delete | 1 inbound message |
| Message reaction summary delivery | 1 outbound message per subscriber; multiple reactions may be rolled up into a single summary |
| [Presence enter](/docs/chat/rooms/presence) | 1 inbound message |
| [Presence leave](/docs/chat/rooms/presence) | 1 inbound message |
| [Presence update](/docs/chat/rooms/presence) | 1 inbound message |
| Presence event delivery | 1 outbound message per presence subscriber |
| [Occupancy](/docs/chat/rooms/occupancy) event | 1 outbound message per subscriber (generated on membership changes, debounced up to 15s) |
| [Moderation](/docs/chat/moderation) action | 1 inbound message; triggers a message update or delete which follows standard delivery |

## Rooms, channels, and connections <a id="rooms-connections"/>

Each Chat room maps to underlying Pub/Sub channels. Each room feature (messages, typing, reactions, presence, occupancy) uses its own channel, contributing to your [channel count](/docs/platform/pricing#channels). Ably bills each connected client for [connection minutes](/docs/platform/pricing#connections) in the same way as Pub/Sub.

## Cost optimization <a id="optimization"/>

### Reduce typing indicator frequency

Increase the `heartbeatThrottleMs` [room option](/docs/chat/rooms#typing) to reduce typing indicator event frequency. The default is 10 seconds. Increase this value in rooms that tolerate delayed typing feedback.

### Disable typing indicators

Disable typing indicators entirely in rooms where they are not needed. This eliminates a significant source of messages, especially in rooms with many participants.

### Use server-side batching

[Server-side batching](/docs/guides/pub-sub/data-streaming#solution-server-side-batching) groups messages into single deliveries. Use this for high-throughput rooms where slight delay is acceptable.

### Use occupancy instead of presence

Use [occupancy](/docs/chat/rooms/occupancy) instead of [presence](/docs/chat/rooms/presence) when you only need member counts, not individual identities. This avoids the n-squared presence event fan-out. For example, 200 members joining and leaving generates approximately **80,400 messages**. See [large-scale presence sets](/docs/presence-occupancy/presence#large-presence) for details.

### Enable server-side presence batching

Enable [server-side batching](/docs/presence-occupancy/presence#large-presence) to group presence events. Subscribe to presence updates only on rooms where you need member-level detail.
2 changes: 1 addition & 1 deletion src/pages/docs/liveobjects/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ LiveObjects [durably stores](/docs/liveobjects/storage) all objects on a channel

LiveObjects usage is billed based on [Ably's standard pricing model](/docs/platform/pricing). Since LiveObjects is powered by Ably's channel messages, any interaction with LiveObjects - whether sending or receiving operations, maintaining active channels, or keeping connections open through the Realtime LiveObjects API - translates into billable usage. Storage of objects themselves does not incur additional costs; however, there is a [limit](/docs/liveobjects/storage) on the size of the channel object.

For details on how using LiveObjects contributes to your billable usage, see [Billing](/docs/liveobjects/concepts/billing).
For details on how using LiveObjects contributes to your billable usage, see [LiveObjects pricing](/docs/liveobjects/pricing).

### Realtime API <a id="pricing-realtime"/>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
---
title: Billing
meta_description: "Understand how LiveObjects operations contribute to your Ably usage and billing."
title: "LiveObjects pricing"
meta_description: "Understand how LiveObjects operations contribute to your message count, including LiveMap, LiveCounter, synchronization, and REST API usage."
meta_keywords: "LiveObjects pricing, message counting, LiveMap, LiveCounter, ObjectMessages"
intro: "How LiveObjects operations contribute to your message count."
redirect_from:
- /docs/liveobjects/concepts/billing
---

<If lang="javascript">
<Aside data-type='public-preview'>
LiveObjects JavaScript is in Public Preview. We are committed to supporting the LiveObjects Javascript API and welcome adoption and feedback.
LiveObjects JavaScript is in Public Preview. Ably is committed to supporting the LiveObjects JavaScript API and welcomes adoption and feedback.

**Building with LiveObjects?** Help shape its future by [sharing your use case](https://44qpp.share.hsforms.com/2fZobHQA1ToyRfB9xqZYQmQ).
</Aside>
Expand All @@ -25,26 +29,38 @@ meta_description: "Understand how LiveObjects operations contribute to your Ably
</Aside>
</If>

LiveObjects operations are billed as messages. This page explains how different LiveObjects operations contribute to your Ably usage.
LiveObjects operations are billed using ObjectMessages. Each ObjectMessage follows the standard inbound/outbound counting pattern.

<Aside data-type="further-reading">
For general information about Ably pricing and billing, see [Pricing](/docs/platform/pricing).
For how all Ably products count messages, see [message counting](/docs/platform/pricing/message-counting). For package comparison and volume discounts, see the [pricing](https://ably.com/pricing) page.
</Aside>

## Message counting <a id="message-counting"/>
## LiveObjects operations <a id="operations"/>

Each operation is sent as an [`ObjectMessage`](/docs/liveobjects/concepts/operations#properties). Ably bills for each outbound message sent from a client, and for each inbound message delivered to each client.
The following table shows how LiveObjects operations contribute to your message count:

When a client performs an operation (such as setting a value on a `LiveMap` or incrementing a `LiveCounter`), this generates an outbound message. When that operation is broadcast to other connected clients, each client receives an inbound message.
| Operation | Messages counted |
| --- | --- |
| [LiveMap](#livemap-operations) set or remove | 1 inbound message per operation |
| [LiveMap](#livemap-operations) create (shallow) | 2 inbound messages (create + assign) |
| [LiveCounter](#livecounter-operations) increment or decrement | 1 inbound message |
| [LiveCounter](#livecounter-operations) create | 2 inbound messages (create + assign) |
| ObjectMessage delivery | 1 outbound message per connected client |
| [Synchronization](#synchronization) | 1 message per object synchronized |
| [REST API](#rest-api) fetch | 1 message per object in response |
| [Batch](#livemap-operations) operation | 1 message per operation in the batch |

For example, if 5 clients are connected to a channel and one client increments a counter:
Nested object creation generates additional messages for each nested object. See the [examples below](#livemap-operations) for details.

- 1 outbound message (from the client performing the increment)
- 5 inbound messages (one delivered to each of the 5 connected clients, including the client that sent it)
## Channels and connections <a id="channels-connections"/>

Each LiveObjects channel contributes to your [channel count](/docs/platform/pricing#channels). Ably bills [connection minutes](/docs/platform/pricing#connections) per minute of connection time for each connected client.

Subscribing to updates does not affect the number of messages received by a client. Any client attached to a channel with the `object-subscribe` capability automatically receives all object messages for that channel. Subscribing to updates on an object adds a listener that is called whenever the client receives updates for that object.

<If lang="javascript">

## LiveMap operations <a id="livemap-operations"/>
## LiveMap operation examples <a id="livemap-operations"/>

Removing a key and setting a primitive value always sends one message:

Expand Down Expand Up @@ -100,7 +116,7 @@ await myObject.get('settings').batch((ctx) => {
```
</Code>

## LiveCounter operations <a id="livecounter-operations"/>
## LiveCounter operation examples <a id="livecounter-operations"/>

Incrementing and decrementing a counter always sends one message:

Expand Down Expand Up @@ -165,10 +181,6 @@ Similarly, if a client becomes disconnected and needs to resynchronize, it will

Only [reachable](/docs/liveobjects/concepts/objects#reachability) objects are counted. Ably may send [tombstone](/docs/liveobjects/concepts/objects#tombstones) objects to the client, but these will not count towards your usage.

## Subscriptions <a id="subscriptions"/>

Subscribing to updates does not affect the number of messages received by a client. Any client attached to a channel with the `object-subscribe` capability automatically receives all object messages for that channel. Subscribing to updates on an object adds a listener that is called whenever the client receives updates for that object.

## REST API <a id="rest-api"/>

The [LiveObjects REST API](/docs/liveobjects/rest-api-usage) also counts messages for operations performed.
Expand Down
Loading