Skip to content

Commit dc7e1f2

Browse files
authored
Merge pull request #3234 from ably/DX-883-message-billing
[DX-883] Addresses message billing docs gap
2 parents b5e159b + 1d1e8f3 commit dc7e1f2

14 files changed

Lines changed: 498 additions & 182 deletions

File tree

src/data/nav/chat.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,10 @@ export default {
228228
},
229229
],
230230
},
231+
{
232+
name: 'Chat pricing',
233+
link: '/docs/chat/pricing',
234+
},
231235
{
232236
name: 'Guides',
233237
pages: [

src/data/nav/liveobjects.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,6 @@ export default {
6060
link: '/docs/liveobjects/concepts/synchronization',
6161
languages: ['javascript', 'swift', 'java'],
6262
},
63-
{
64-
name: 'Billing',
65-
link: '/docs/liveobjects/concepts/billing',
66-
languages: ['javascript', 'swift', 'java'],
67-
},
6863
],
6964
},
7065
{
@@ -113,6 +108,10 @@ export default {
113108
},
114109
],
115110
},
111+
{
112+
name: 'LiveObjects pricing',
113+
link: '/docs/liveobjects/pricing',
114+
},
116115
],
117116
api: [
118117
{

src/data/nav/livesync.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ export default {
4848
},
4949
],
5050
},
51+
{
52+
name: 'LiveSync pricing',
53+
link: '/docs/livesync/pricing',
54+
},
5155
],
5256
api: [
5357
{

src/data/nav/platform.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ export default {
130130
link: '/docs/platform/pricing/billing',
131131
name: 'Billing',
132132
},
133+
{
134+
link: '/docs/platform/pricing/message-counting',
135+
name: 'Message counting',
136+
},
133137
{
134138
link: '/docs/platform/pricing/limits',
135139
name: 'Limits',

src/data/nav/pubsub.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,10 @@ export default {
365365
},
366366
],
367367
},
368+
{
369+
name: 'Pub/Sub pricing',
370+
link: '/docs/pub-sub/pricing',
371+
},
368372
{
369373
name: 'Guides',
370374
pages: [

src/data/nav/spaces.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ export default {
6262
},
6363
],
6464
},
65+
{
66+
name: 'Spaces pricing',
67+
link: '/docs/spaces/pricing',
68+
},
6569
],
6670
api: [
6771
{

src/pages/docs/chat/pricing.mdx

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
title: "Chat pricing"
3+
meta_description: "Understand how Chat SDK features contribute to your message count, including messages, typing indicators, reactions, and cost optimization strategies."
4+
meta_keywords: "chat pricing, message counting, typing indicators, reactions, cost optimization"
5+
intro: "How Chat SDK features contribute to your message count and strategies to optimize costs."
6+
---
7+
8+
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.
9+
10+
## Chat operations <a id="operations"/>
11+
12+
The following table shows how Chat operations contribute to your message count:
13+
14+
| Operation | Messages counted |
15+
| --- | --- |
16+
| [Messages](/docs/chat/rooms/messages) ||
17+
| Send message | 1 inbound message |
18+
| Message delivery | 1 outbound message per subscriber |
19+
| Update message | 1 inbound message |
20+
| Message update delivery | 1 outbound message per subscriber |
21+
| Delete message | 1 inbound message |
22+
| Message deletion delivery | 1 outbound message per subscriber |
23+
| [History](/docs/chat/rooms/history) ||
24+
| History retrieval | 1 outbound message per retrieved message |
25+
| [Typing indicators](/docs/chat/rooms/typing) ||
26+
| Typing keystroke | 1 inbound message; repeats every heartbeat interval (default 10s) |
27+
| Typing keystroke delivery | 1 outbound message per subscriber per heartbeat |
28+
| Typing stop | 1 inbound message |
29+
| Typing stop delivery | 1 outbound message per subscriber |
30+
| [Room reactions](/docs/chat/rooms/reactions) ||
31+
| Room reaction | 1 inbound message |
32+
| Room reaction delivery | 1 outbound message per subscriber |
33+
| [Message reactions](/docs/chat/rooms/message-reactions) ||
34+
| Message reaction send | 1 inbound message |
35+
| Message reaction delete | 1 inbound message |
36+
| Message reaction summary delivery | 1 outbound message per subscriber; multiple reactions may be rolled up into a single summary |
37+
| [Presence](/docs/chat/rooms/presence) ||
38+
| Presence enter | 1 inbound message |
39+
| Presence leave | 1 inbound message |
40+
| Presence update | 1 inbound message |
41+
| Presence event delivery | 1 outbound message per presence subscriber |
42+
| [Occupancy](/docs/chat/rooms/occupancy) ||
43+
| Occupancy event | 1 outbound message per subscriber (generated on membership changes, debounced up to 15s) |
44+
| [Moderation](/docs/chat/moderation) ||
45+
| Moderation rule invocation (before or after publish) | 1 outbound webhook event per moderated message |
46+
47+
## Rooms and channels <a id="channels"/>
48+
49+
Each Chat [room](/docs/chat/rooms) is backed by a single Ably Pub/Sub channel. All room features, such as messages, typing, reactions, presence, and occupancy, share that one channel.
50+
51+
Channels contribute to your [channel count](/docs/platform/pricing#channels). The more rooms a client is attached to, the more channels are consumed. [Detach](/docs/chat/rooms#detach) from rooms when they are no longer needed, and [release](/docs/chat/rooms#release) rooms that are no longer in use to reduce your channel count.
52+
53+
## Connections <a id="connections"/>
54+
55+
Ably bills each connected client for [connection minutes](/docs/platform/pricing#connections). 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. Close connections when the client is done to stop accruing connection minutes.
56+
57+
## Cost optimization <a id="optimization"/>
58+
59+
### Reduce typing indicator frequency
60+
61+
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.
62+
63+
### Use server-side batching
64+
65+
[Server-side batching](/docs/messages/batch#server-side) groups messages into single deliveries. Use this for high-throughput rooms where slight delay is acceptable.
66+
67+
### Use occupancy instead of presence
68+
69+
Use [occupancy](/docs/chat/rooms/occupancy) instead of [presence](/docs/chat/rooms/presence) when you only need member counts, not individual identities.

src/pages/docs/liveobjects/concepts/billing.mdx

Lines changed: 0 additions & 176 deletions
This file was deleted.

src/pages/docs/liveobjects/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ LiveObjects [durably stores](/docs/liveobjects/storage) all objects on a channel
9494

9595
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.
9696

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

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

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
title: "LiveObjects pricing"
3+
meta_description: "Understand how LiveObjects operations contribute to your message count, including LiveMap, LiveCounter, synchronization, and REST API usage."
4+
meta_keywords: "LiveObjects pricing, message counting, LiveMap, LiveCounter, ObjectMessages"
5+
intro: "How LiveObjects operations contribute to your message count and strategies to optimize costs."
6+
redirect_from:
7+
- /docs/liveobjects/concepts/billing
8+
---
9+
10+
Ably bills LiveObjects operations using ObjectMessages. An ObjectMessage is the unit of change in LiveObjects. Each state mutation, such as setting a key, incrementing a counter, or creating an object, generates one or more ObjectMessages. Each ObjectMessage follows the standard inbound/outbound counting pattern.
11+
12+
## LiveObjects operations <a id="operations"/>
13+
14+
The following table shows how LiveObjects operations contribute to your message count:
15+
16+
| Operation | Messages counted |
17+
| --- | --- |
18+
| [LiveMap](/docs/liveobjects/map) ||
19+
| LiveMap set or remove | 1 inbound message per operation |
20+
| LiveMap create (shallow) | 2 inbound messages (create + assign) |
21+
| [LiveCounter](/docs/liveobjects/counter) ||
22+
| LiveCounter increment or decrement | 1 inbound message |
23+
| LiveCounter create | 2 inbound messages (create + assign) |
24+
| ObjectMessage delivery | 1 outbound message per connected client |
25+
| [Synchronization](#synchronization) | 1 outbound message per object synchronized |
26+
| [REST API](#rest-api) fetch | 1 outbound message per object in response |
27+
| [Batch](/docs/liveobjects/batch) operation | 1 inbound message per operation in the batch |
28+
29+
Nested object creation generates additional messages for each nested object.
30+
31+
## Channels <a id="channels"/>
32+
33+
Each LiveObjects channel contributes to your [channel count](/docs/platform/pricing#channels). 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.
34+
35+
## Connections <a id="connections"/>
36+
37+
Ably bills each connected client for [connection minutes](/docs/platform/pricing#connections). 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.
38+
39+
## Cost optimization <a id="optimization"/>
40+
41+
### Prefer flat data structures
42+
43+
Setting a primitive value on a LiveMap costs one message. Creating a nested LiveMap costs two or more messages (one to create the object, one to assign it), plus additional messages for each level of nesting. Flatten your data model where possible to reduce the number of messages per update.
44+
45+
### Minimize objects per channel
46+
47+
Each object on a channel is synchronized when a client attaches or resynchronizes. Fewer objects per channel reduces the cost of synchronization. Distribute objects across channels based on which clients need access to them.
48+
49+
## Synchronization <a id="synchronization"/>
50+
51+
During initial synchronization and resynchronization, Ably sends each object on the channel as a message.
52+
53+
For example, if a channel contains 10 objects (such as `LiveMap` and `LiveCounter` instances), a client attaching to the channel receives 10 messages during synchronization.
54+
55+
Similarly, if a client becomes disconnected and needs to resynchronize, it receives messages for each object that needs to be synchronized.
56+
57+
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.
58+
59+
## REST API <a id="rest-api"/>
60+
61+
The [LiveObjects REST API](/docs/liveobjects/rest-api-usage) also counts messages for operations performed.
62+
63+
When fetching objects via the REST API, each instance of an [object type](/docs/liveobjects/concepts/objects#object-types) included in the response is counted as one message.
64+
65+
Each operation published via the REST API counts as one message. When creating objects using the `path` field, the server constructs two messages (a create operation and a `MAP_SET` operation to assign it).

0 commit comments

Comments
 (0)