Skip to content

Commit 298a0ef

Browse files
committed
Update message / annotations docs for protocol v4 messages
And remove references to `version` for now until we add the update/delete docs. Our docs will just unconditionally use protocol v4 message docs for annotations and updates, since by the time we release those features experimentally all 3 sdks which had support for them will be updated to v4.
1 parent a415299 commit 298a0ef

File tree

7 files changed

+30
-40
lines changed

7 files changed

+30
-40
lines changed

content/api/realtime-sdk/messages.textile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,8 @@ h2(#properties).
2525
python: Attributes
2626

2727
<%= partial partial_version('types/_message') %>
28+
29+
h2(#message-annotations).
30+
default: MessageAnnotations
31+
32+
<%= partial partial_version('types/_message_annotations') %>

content/api/realtime-sdk/types.textile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ blang[jsall].
8787

8888
<%= partial partial_version('types/_message_action') %>
8989

90-
h3(#message-operation).
91-
default: Operation
90+
h3(#message-annotations).
91+
default: MessageAnnotations
9292

93-
<%= partial partial_version('types/_operation') %>
93+
<%= partial partial_version('types/_message_annotations') %>
9494

9595
h3(#presence-message).
9696
default: PresenceMessage

content/partials/types/_message.textile

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ h6(#timestamp).
5151
default: timestamp
5252
csharp: Timestamp
5353

54-
Timestamp when the message was received by the Ably, as <span lang="default">milliseconds since the epoch</span><span lang="ruby">a @Time@ object</span><br>.__Type: <span lang="default">@Integer@</span><span lang="java">@Long Integer@</span><span lang="csharp">@DateTimeOffset@</span><span lang="ruby">@Time@</span><span lang="objc,swift">@NSDate@</span>__
54+
Timestamp when the message was first received by the Ably, as <span lang="default">milliseconds since the epoch</span><span lang="ruby">a @Time@ object</span><br>.__Type: <span lang="default">@Integer@</span><span lang="java">@Long Integer@</span><span lang="csharp">@DateTimeOffset@</span><span lang="ruby">@Time@</span><span lang="objc,swift">@NSDate@</span>__
5555

5656
h6(#encoding).
5757
default: encoding
@@ -69,22 +69,12 @@ blang[jsall].
6969
h6(#serial).
7070
default: serial
7171

72-
This message's unique serial (an identifier that will be the same in all future updates of this message).<br>__Type: @String@__
72+
The message's serial (a server-assigned identifier that will be the same in all future updates of this message, and can be used to add annotations). Right now this will only be set if you enable annotations in "channel rules":/docs/channels#rules .<br>__Type: @String@__
7373

74-
h6(#created-at).
75-
default: createdAt
74+
h6(#annotations).
75+
default: annotations
7676

77-
The timestamp of the very first version of a given message (will differ from @timestamp@ only if the message has been updated or deleted).<br>__Type: @Integer@__
78-
79-
h6(#version).
80-
default: version
81-
82-
The version of the message, lexicographically-comparable with other versions (that share the same serial). Will differ from the serial only if the message has been updated or deleted.<br>__Type: @String@__
83-
84-
h6(#operation).
85-
default: operation
86-
87-
In the case of an updated or deleted message, this will contain metadata about the update or delete operation.<br>__Type: "@Operation@":/docs/api/realtime-sdk/types#message-operation__
77+
An object containing information about annotations that have been made to the object.<br>__Type: "@MessageAnnotations@":/docs/api/realtime-sdk/types#message-annotations__
8878

8979
h3(constructors).
9080
default: Message constructors
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
h4.
2+
default: Properties
3+
java: Members
4+
ruby: Attributes
5+
python: Attributes
6+
7+
- <span lang="default">summary</span> := An object whose keys are annotation types, and the values are aggregated summaries for that annotation type<br>__Type: @Record<String, JsonObject>@__

content/partials/types/_operation.textile

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

src/pages/docs/messages/annotations.mdx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ Annotations can be enabled for a channel or channel namespace with the *Message
2424
Note that when message annotations are enabled, messages are [persisted](/docs/storage-history/storage#all-message-persistence) by default, and [continuous history](/docs/storage-history/history#continuous-history) features are not currently supported.
2525
</Aside>
2626

27-
1. On your [dashboard](https://ably.com/accounts/any), select one of your apps.
28-
2. Go to **Settings**.
27+
1. Go to the [**Settings**](https://ably.com/accounts/any/apps/any/edit) tab of an app in your dashboard.
2928
3. Under [channel rules](/docs/channels#rules), click **Add new rule**.
3029
4. Enter the channel name or channel namespace on which to enable message annotations.
3130
5. Check **Message annotations, updates, and deletes** to enable message annotations.
@@ -189,7 +188,7 @@ await channel.annotations.publish(message, {
189188
name: 'delivered'
190189
});
191190

192-
// You can also use a message's serial number
191+
// You can also use a message's `serial`
193192
await channel.annotations.publish(message.serial, {
194193
type: 'receipts:flag.v1',
195194
name: 'delivered'
@@ -211,7 +210,7 @@ await channel.annotations.publish(message, {
211210
name: 'delivered'
212211
});
213212
214-
// You can also use a message's serial number
213+
// You can also use a message's `serial`
215214
await channel.annotations.publish(message.serial, {
216215
type: 'receipts:flag.v1',
217216
name: 'delivered'
@@ -283,11 +282,11 @@ await channel.annotations.delete(message.serial, {
283282
```
284283
</Code>
285284

286-
## Subscribe to annotations <a id="subscribe" />
285+
## Subscribe to annotation summaries <a id="subscribe" />
287286

288287
The recommended way to receive annotation updates is through annotation summaries. These events provide a summary of the complete, current state of all annotations for a message whenever an annotation is published or deleted.
289288

290-
Annotation summaries are delivered to subscribers as messages with an `action` of `message.summary`. These messages have a `summary` field which provides a summary of all the annotations for the message, identified by the `serial` field on the summary message.
289+
Annotation summaries are delivered to subscribers as messages with an `action` of `message.summary`, and a `serial` matching the `serial` of the message that they are updating. They have an `annotations` field which contains a `summary` of all the annotations for the message.
291290

292291
The value of the `summary` field is an object where the keys are the [annotation types](#annotation-types). The structure of the value of each key depends on the summarization method used, for example `total.v1` will have a `total` field, while `flag.v1` will have `total` and `clientIds` fields.
293292

src/pages/docs/messages/index.mdx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,15 @@ The following are the properties of a message:
2727
|----------|-------------|
2828
| **name** | The name of the message |
2929
| **data** | The contents of the message. Also known as the message payload |
30-
| **id** | Each message sent through Ably is assigned a unique ID, unless you provide your own ID. Client specified IDs ensure [publishes are idempotent](/docs/pub-sub/advanced#idempotency) |
30+
| **id** | Each message sent through Ably is assigned a unique ID, unless you provide your own ID, which serves as the [idempotency key](/docs/pub-sub/advanced#idempotency) |
3131
| **clientId** | The [ID of the client](/docs/auth/identified-clients) that published the message |
3232
| **connectionId** | The ID of the connection used to publish the message |
33-
| **timestamp** | The timestamp of when the message was received by Ably, as milliseconds since the Unix epoch |
33+
| **timestamp** | The timestamp of when the message was first received by Ably, as milliseconds since the Unix epoch |
3434
| **extras** | A JSON object of arbitrary key-value pairs that may contain metadata, and/or ancillary payloads. Valid payloads include those related to [Push Notifications](/docs/push), [deltas](/docs/channels/options/deltas) and headers |
3535
| **encoding** | This is typically empty, as all messages received from Ably are automatically decoded client-side using this value. However, if the message encoding cannot be processed, this attribute contains the remaining transformations not applied to the data payload |
36-
37-
<aside data-type='note'>
38-
Additional properties are included on a message when using message [annotations](/docs/messages/annotations) .
39-
</aside>
36+
| **action** | An [enum](/docs/api/realtime-sdk/types#message-action) telling you whether this is a normal ('create') message, an update to a previous message, an annotation summary, etc. |
37+
| **serial** | The message's serial (a server-assigned identifier that will be the same in all future updates of this message, and can be used to add [annotations](/docs/messages/annotations)). Right now this will only be set if you enable annotations in [channel rules](/docs/channels#rules) |
38+
| **annotations** | An object containing a summary of any [annotations](/docs/messages/annotations) that have been made to the message |
4039

4140
## Message conflation <a id="conflation"/>
4241

0 commit comments

Comments
 (0)