Skip to content

Commit ed9ed44

Browse files
committed
fixup! annotations: publish, subscribe, summary and type
1 parent 66505d9 commit ed9ed44

File tree

1 file changed

+55
-2
lines changed

1 file changed

+55
-2
lines changed

src/pages/docs/messages/annotations.mdx

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,62 @@ The annotation type is a string of the format `namespace:summarization.version`
319319

320320
When annotations for a message are published, Ably automatically generates a summary that provides an aggregated view of all annotations for that message.
321321

322-
A separate summary is produced for each distinct [annotation type](#annotation-types).
322+
A separate summary is produced for each distinct [annotation type](#annotation-types). The summarization method specified in the [annotation type](#annotation-types) determines how annotations in the same namespace for a given message are aggregated into a summary. A summary is constructed from the set of `annotation.create` and `annotation.delete` messages that have been published for a message.
323+
324+
You can [subscribe](#subscribe-annotation-summaries) to these summaries using the `subscribe()` method on a channel, and they will be delivered as messages with an `action` of `message.summary`. The summary will be included on the message's `summary` field, which is an object whose keys are the [annotation types](#annotation-types) and whose values describe the annotation summary for that type:
325+
326+
<Code>
327+
```json
328+
{
329+
"metrics:total.v1": {
330+
"total": 42
331+
},
332+
"reactions:flag.v1": {
333+
"total": 3,
334+
"clientIds": ["client1", "client2", "client3"]
335+
},
336+
"categories:distinct.v1": {
337+
"important": {
338+
"total": 2,
339+
"clientIds": ["client1", "client3"]
340+
},
341+
"urgent": {
342+
"total": 3,
343+
"clientIds": ["client1", "client2", "client3"]
344+
}
345+
},
346+
"status:unique.v1": {
347+
"important": {
348+
"total": 2,
349+
"clientIds": ["client1", "client3"]
350+
},
351+
"urgent": {
352+
"total": 1,
353+
"clientIds": ["client2"]
354+
}
355+
},
356+
"voting:multiple.v1": {
357+
"option-a": {
358+
"total": 7,
359+
"clientCounts": {
360+
"client1": 3,
361+
"client2": 2
362+
},
363+
"totalUnidentified": 2
364+
},
365+
"option-b": {
366+
"total": 4,
367+
"clientCounts": {
368+
"client1": 2,
369+
"client3": 1
370+
},
371+
"totalUnidentified": 1
372+
}
373+
}
374+
}
375+
```
376+
</Code>
323377

324-
The summarization method specified in the [annotation type](#annotation-types) determines how annotations in the same namespace for a given message are aggregated into a summary. A summary is constructed from the set of `annotation.create` and `annotation.delete` messages that have been published for a message.
325378

326379
When [publishing](#publish) an annotation you can optionally specify a `name` which is used by some summarization methods to produce a summary.
327380

0 commit comments

Comments
 (0)