Skip to content

Commit 850b8d7

Browse files
committed
Update LiveObjects docs to reflect support for JSON-serializable objects as LiveMap values
ably-js support for this added in [1] [1] ably/ably-js#2052
1 parent c8e3fb7 commit 850b8d7

5 files changed

Lines changed: 11 additions & 9 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ LiveObjects provides specialized object types to model your application state. T
2020
[LiveMap](/docs/liveobjects/map) is a key/value data structure similar to a dictionary or JavaScript [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map):
2121

2222
* Keys must be strings
23-
* Values can be primitive types or [references](#composability) to other objects
23+
* Values can be primitive types, JSON-serializable objects or arrays, or [references](#composability) to other objects
2424
* Supports `set` and `remove` operations
2525
* Concurrent updates to the same key are resolved using last-write-wins (LWW) semantics
2626

src/pages/docs/liveobjects/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ LiveObjects provides specialized object types to model your application state. T
5757

5858
#### LiveMap <a id="map"/>
5959

60-
[LiveMap](/docs/liveobjects/map) is a key/value data structure that synchronizes its state across users in realtime. It enables you to store primitive values, such as numbers, strings, booleans and buffers, as well as other objects, enabling [composable data structures](#composability).
60+
[LiveMap](/docs/liveobjects/map) is a key/value data structure that synchronizes its state across users in realtime. It enables you to store primitive values, such as numbers, strings, booleans and buffers; JSON-serializable objects or arrays; and other LiveObjects types, enabling [composable data structures](#composability).
6161

6262
### Composability <a id="composability"/>
6363

src/pages/docs/liveobjects/map.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ LiveObjects is currently Experimental. Its features are still in development and
99
**Building with LiveObjects?** Help shape its future by [sharing your use case](https://44qpp.share.hsforms.com/2fZobHQA1ToyRfB9xqZYQmQ).
1010
</Aside>
1111

12-
LiveMap is a key/value data structure that synchronizes its state across users in realtime. It enables you to store primitive values, such as numbers, strings, booleans and buffers, as well as other objects, [enabling you to build complex, hierarchical object structure](#composability).
12+
LiveMap is a key/value data structure that synchronizes its state across users in realtime. It enables you to store primitive values, such as numbers, strings, booleans and buffers; JSON-serializable objects or arrays; and other LiveObjects types, [enabling you to build complex, hierarchical object structure](#composability).
1313

1414
Conflicts in a LiveMap are automatically resolved with last-write-wins (LWW) semantics. The latest received operation on a key will be applied to the LiveMap and broadcast to all clients.
1515

@@ -120,7 +120,7 @@ map.unsubscribeAll();
120120

121121
Set a value for a key in a map by calling `LiveMap.set()`. This operation is synchronized across all clients and triggers data subscription callbacks for the map, including on the client making the request.
122122

123-
Keys in a map can contain numbers, strings, booleans and buffers, as well as other `LiveMap` and `LiveCounter` objects.
123+
Keys in a map can contain numbers, strings, booleans and buffers; JSON-serializable objects or arrays; and other `LiveMap` and `LiveCounter` objects.
124124

125125
This operation is asynchronous, as the client sends the corresponding update operation to the Ably system and waits for acknowledgment of the successful map key update.
126126

src/pages/docs/liveobjects/rest-api-usage.mdx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ The key in the `data` object indicates the type of the value:
2727

2828
<Code>
2929
```json
30-
{ "data": { "number" : 42 }}
31-
{ "data": { "string" : "LiveObjects is awesome" }}
32-
{ "data": { "boolean" : true }}
33-
{ "data": { "bytes": "TGl2ZU9iamVjdHMgaXMgYXdlc29tZQo=" }}
34-
{ "data": { "objectId": "counter:JbZYiHnw0ORAyzzLSQahVik31iBDL_ehJNpTEF3qwg8@1745828651669" }}
30+
{ "data": { "number": 42 } }
31+
{ "data": { "string": "LiveObjects is awesome" } }
32+
{ "data": { "string": "{\"hello\":\"world\"}", "encoding": "json" } }
33+
{ "data": { "boolean": true } }
34+
{ "data": { "bytes": "TGl2ZU9iamVjdHMgaXMgYXdlc29tZQo=" } }
35+
{ "data": { "objectId": "counter:JbZYiHnw0ORAyzzLSQahVik31iBDL_ehJNpTEF3qwg8@1745828651669" } }
3536
```
3637
</Code>
3738

src/pages/docs/liveobjects/storage.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ The size of a `LiveMap` object is calculated as the sum of the length of all key
5151
* `number` values are 8 bytes
5252
* `boolean` values are 1 byte
5353
* `bytes` values are the length of the byte array
54+
* JSON-serializable object or array values are equal to the length of their corresponding JSON strings
5455

5556
The maximum allowed size of a single `LiveMap` object is the same as the [message size limit](/docs/pricing/limits#message) for your package. This is because objects are [synchronized](/docs/liveobjects/concepts/synchronization#client-objects) to the client as channel messages.
5657

0 commit comments

Comments
 (0)