Skip to content

Commit 2e2ac11

Browse files
committed
Update LiveObjects docs for aggregate limits and notification mode
- Clarify that the 6.5 MB object size limit is an aggregate across all objects on a channel, with no limit on object count - Document the 64 KiB per-operation size constraint and that objects can grow beyond it via incremental updates - Note that large objects may be split across multiple sync messages, affecting billing message counts - Add documentation for the new 'notification' inband objects mode, which sends a REST API link instead of streaming full state - Restructure inband-objects.mdx into 'objects mode' and 'notification mode' sections - Fix limits.mdx description to say "aggregate size of all objects"
1 parent 5280580 commit 2e2ac11

File tree

7 files changed

+79
-18
lines changed

7 files changed

+79
-18
lines changed

src/pages/docs/channels/options/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ Occupancy events have a payload in the `data` property with a value of `occupanc
430430

431431
### Inband Objects <a id="objects"/>
432432

433-
[Inband objects](/docs/liveobjects/inband-objects) allows clients to subscribe to changes to [LiveObjects](/docs/liveobjects) channel objects as regular channel messages.
433+
[Inband objects](/docs/liveobjects/inband-objects) allows clients to subscribe to changes to [LiveObjects](/docs/liveobjects) channel objects as regular channel messages. Set the `objects` channel parameter to `'objects'` to stream the full state, or `'notification'` to receive change notifications.
434434

435435
When using inband objects, the client receives messages with the special name `[meta]objects` that describe the current set of objects on a channel.
436436

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ await myObject.get('visits').batch((ctx) => {
157157

158158
## Synchronization <a id="synchronization"/>
159159

160-
During initial synchronization and resynchronization, each object on the channel is sent as a message.
160+
During initial synchronization and resynchronization, each object on the channel is sent as one or more messages. Large objects, such as maps with many entries, may be split across multiple messages.
161161

162-
For example, if a channel contains 10 objects (such as `LiveMap` and `LiveCounter` instances), a client attaching to the channel will receive 10 messages during synchronization.
162+
For example, if a channel contains 10 objects (such as `LiveMap` and `LiveCounter` instances), a client attaching to the channel will receive at least 10 messages during synchronization.
163163

164164
Similarly, if a client becomes disconnected and needs to resynchronize, it will receive messages for each object that needs to be synchronized.
165165

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ When a channel first becomes active in a region, the channel loads the object da
4141

4242
While Ably maintains the source of truth on the channel, each connected client keeps a local representation of the objects on the channel.
4343

44-
When the client first attaches to the channel, the state of the channel objects is streamed to the client. [Lifecycle events](/docs/liveobjects/lifecycle#synchronization) allow your application to be notified when the local state is being synchronized with the Ably service.
44+
When the client first attaches to the channel, the state of the channel objects is streamed to the client. Large objects, such as maps with many entries, may be delivered across multiple messages during synchronization. [Lifecycle events](/docs/liveobjects/lifecycle#synchronization) allow your application to be notified when the local state is being synchronized with the Ably service.
4545

4646
<If lang="javascript">
4747
<Aside data-type='note'>

src/pages/docs/liveobjects/inband-objects.mdx

Lines changed: 65 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,28 @@ If you're using LiveObjects from one of the the following languages, then use th
3535
* [Java](/docs/liveobjects/quickstart/java)
3636
</Aside>
3737

38-
Inband objects works by delivering changes to channel objects as regular channel messages, similar to [inband occupancy](/docs/channels/options#occupancy).
38+
Inband objects works by delivering changes to channel objects as regular channel messages, similar to [inband occupancy](/docs/channels/options#occupancy). Two modes are available:
39+
40+
* `objects` streams the full state of channel objects as a sequence of messages on attach and whenever the state changes.
41+
* `notification` sends a lightweight notification whenever the state changes, with a link to retrieve the full state via the [REST API](/docs/liveobjects/rest-api-usage).
3942

4043
<Aside data-type='usp'>
4144
Scalable message fanout
4245

4346
Inband object updates are delivered as regular channel messages through Ably's [horizontally scalable architecture](/docs/platform/architecture/platform-scalability), so LiveObjects state changes can be distributed to any number of subscribers simultaneously.
4447
</Aside>
4548

46-
## Enable Inband Objects <a id="inband-objects-enable"/>
49+
<Aside data-type='important'>
50+
Clients require the `channel-metadata` [capability](/docs/auth/capabilities) to receive inband objects updates.
51+
</Aside>
52+
53+
## Objects mode <a id="objects-mode"/>
54+
55+
The `objects` mode streams the full state of channel objects to the client. On attach, the client receives a sequence of `[meta]objects` messages describing the complete set of objects on the channel. When objects are updated, the client receives additional messages with the updated state.
4756

48-
To enable inband objects, use the `objects` [channel parameter](/docs/channels/options#objects) when getting a channel:
57+
### Enable objects mode <a id="inband-objects-enable"/>
58+
59+
Enable `objects` mode using the `objects` [channel parameter](/docs/channels/options#objects) when getting a channel:
4960

5061
<Code>
5162
```javascript
@@ -58,13 +69,9 @@ await channel.setOptions({ params: { objects: 'objects' } });
5869
```
5970
</Code>
6071

61-
<Aside data-type='important'>
62-
Clients require the `channel-metadata` [capability](/docs/auth/capabilities) to receive inband objects updates.
63-
</Aside>
64-
65-
## Subscribe to updates <a id="inband-objects-subscribe"/>
72+
### Subscribe to updates <a id="inband-objects-subscribe"/>
6673

67-
When using inband objects, the client will receive special `[meta]objects` messages whenever the objects on the channel are updated. These messages provide a snapshot of the current set of objects on the channel.
74+
The client receives `[meta]objects` messages whenever the objects on the channel are updated. These messages provide a snapshot of the current set of objects on the channel.
6875

6976
<Aside data-type='note'>
7077
If there is a high rate of updates to the channel objects the inband messages are throttled. However, the client is guaranteed to receive a sequence of inband messages after the last change occurs so that the latest data is always available.
@@ -82,7 +89,7 @@ channel.subscribe('[meta]objects', (message) => {
8289
```
8390
</Code>
8491

85-
## Message Format <a id="inband-objects-message-format"/>
92+
### Message format <a id="inband-objects-message-format"/>
8693

8794
Inband objects messages are sent as a sequence of messages, where each message contains a snapshot of a single object on the channel. Taken together, a set of messages belonging to the same sequence describes the complete set of objects on the channel.
8895

@@ -97,3 +104,51 @@ The message `data` is a JSON object with the following top-level properties:
97104
| `object` | A JSON representation of the object included in the message. |
98105

99106
The shape of the `object` is the same as the response format of an object when listing them via the [REST API](/docs/liveobjects/rest-api-usage#fetching-objects-list-values).
107+
108+
## Notification mode <a id="notification-mode"/>
109+
110+
The `notification` mode sends a `[meta]objects` message whenever the channel objects are updated. The message contains a link to retrieve the current state via the [REST API](/docs/liveobjects/rest-api-usage) rather than the full object state.
111+
112+
Unlike `objects` mode, the client does not receive the initial state on attach. The first `[meta]objects` message is sent when the state changes.
113+
114+
<Aside data-type='note'>
115+
Use notification mode when individual objects on the channel may exceed the 64 KiB [message size limit](/docs/liveobjects/storage#operation-size).
116+
</Aside>
117+
118+
### Enable notification mode <a id="notification-enable"/>
119+
120+
Enable notification mode using the `objects` [channel parameter](/docs/channels/options#objects) with a value of `'notification'`:
121+
122+
<Code>
123+
```javascript
124+
const channelOpts = { params: { objects: 'notification' } };
125+
const channel = realtime.channels.get('my-channel', channelOpts);
126+
```
127+
</Code>
128+
129+
### Subscribe to notifications <a id="notification-subscribe"/>
130+
131+
Subscribe to `[meta]objects` messages to receive notifications when channel objects are updated:
132+
133+
<Code>
134+
```javascript
135+
channel.subscribe('[meta]objects', (message) => {
136+
const { link } = message.data;
137+
console.log("Objects updated, retrieve state from:", link);
138+
});
139+
```
140+
</Code>
141+
142+
<Aside data-type='note'>
143+
If there is a high rate of updates to the channel objects, notification messages are throttled after the first one. The client is guaranteed to receive a notification after the last change occurs.
144+
</Aside>
145+
146+
### Notification message format <a id="notification-message-format"/>
147+
148+
Each notification message has a message `name` of `[meta]objects`.
149+
150+
The message `data` is a JSON object with the following property:
151+
152+
| Property | Description |
153+
| -------- | ----------- |
154+
| `link` | A relative URL path to retrieve the current channel objects via the [REST API](/docs/liveobjects/rest-api-usage#fetching-objects). For example, `/channels/{channelName}/object`. |

src/pages/docs/liveobjects/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ For details on how using LiveObjects contributes to your billable usage, see [Bi
102102

103103
When using the realtime client libraries, LiveObjects usage is billed as follows:
104104

105-
* [State synchronization](/docs/liveobjects/concepts/synchronization#client-objects): On first attachment to a channel, or during resynchronization after a loss of continuity, the full state of channel objects is streamed to the client as [object messages](/docs/metadata-stats/stats#messages). Each object message received is counted as one message. Ably streams objects with a [tombstone](/docs/liveobjects/concepts/objects#tombstones) to maintain state consistency but these objects are not included in billing counts.
105+
* [State synchronization](/docs/liveobjects/concepts/synchronization#client-objects): On first attachment to a channel, or during resynchronization after a loss of continuity, the full state of channel objects is streamed to the client as [object messages](/docs/metadata-stats/stats#messages). Each object message received is counted as one message. Large objects may be streamed across multiple object messages, each counted individually. Ably streams objects with a [tombstone](/docs/liveobjects/concepts/objects#tombstones) to maintain state consistency but these objects are not included in billing counts.
106106
* [Object operations](/docs/liveobjects/concepts/operations): Creating or updating an object generates an _operation_, which is sent as an object message on the channel and billed accordingly. For example, if a user increments a counter, one object message is sent. If 10 clients subscribed to object messages receive it, that counts as 11 messages in total. Any client attached to a channel with `object-subscribe` capability is subscribed to all object messages on that channel.
107107
* [Batch operations](/docs/liveobjects/batch): Multiple operations grouped into a batch are sent as a single object message and billed as one.
108108

src/pages/docs/liveobjects/storage.mdx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,18 @@ Short disconnections (under two minutes) are resolved by replaying missed operat
3737

3838
## Object size limit <a id="limits"/>
3939

40-
The channel object has a maximum size limit, the default is 6.5(MB). This takes into account the size of every LiveObject (Map and Counter). When calculating the size of a channel object, Ably ignores any object or map entry with a [tombstone](/docs/liveobjects/concepts/objects#tombstones).
40+
All objects on a channel share an aggregate size limit, which defaults to 6.5 MB. This is the combined size of every `LiveMap` and `LiveCounter` on the channel. There is no limit on the number of individual objects. When calculating the aggregate size, Ably excludes any object or map entry with a [tombstone](/docs/liveobjects/concepts/objects#tombstones), as well as any [unreachable](/docs/liveobjects/concepts/objects#reachability) objects.
4141

4242
<Aside data-type='note'>
43-
If you're interested storing a larger amount of data on a channel, please [get in touch](https://ably.com/support) with your requirements.
43+
If you're interested in storing a larger amount of data on a channel, please [get in touch](https://ably.com/support) with your requirements.
4444
</Aside>
4545

46+
### Operation size <a id="operation-size"/>
47+
48+
Operations are limited by the message size limit of 64 KiB. This means that you cannot initialize an object with data larger than 64 KiB in a single operation. However, an object can grow beyond this size through incremental updates, for example by using a series of `set` operations on a `LiveMap`.
49+
50+
### Size calculation <a id="size-calculation"/>
51+
4652
A `LiveCounter` is a double-precision floating-point number and has a size of 8 bytes.
4753

4854
The size of a `LiveMap` object is calculated as the sum of the length of all keys plus the size of all values where:

src/pages/docs/platform/pricing/limits.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Therefore, to provide the realtime platform-as-a-service economically to all cus
102102
| **Message publish rate per channel (per second)**<p>*the maximum rate at which messages can be published for each channel*</p> | 50 | 50 | 50 | 50 |
103103
| **Presence members per channel**<p>*the maximum number of clients that can be simultaneously present on a channel*</p> | 200 | 200 | 200 | 200 |
104104
| **Presence members per channel with [server-side batching](/docs/messages/batch#server-side) enabled**<p>*the maximum number of clients that can be simultaneously present on a channel when server-side batching is enabled*</p> | 200 | 5,000 | 10,000 | 20,000 |
105-
| **Total object size per channel(MB)**<p>*the maximum size of a channel object*</p> | 6.5 | 6.5 | 6.5 | 6.5 |
105+
| **Total object size per channel(MB)**<p>*the maximum aggregate size of all objects on a channel*</p> | 6.5 | 6.5 | 6.5 | 6.5 |
106106

107107

108108

0 commit comments

Comments
 (0)