Skip to content

Commit ddd65c2

Browse files
authored
Merge pull request #2871 from ably/clipped-message-annotations
Add clipped flag to annotations doc
2 parents 2b00074 + f4b17c8 commit ddd65c2

File tree

1 file changed

+41
-14
lines changed

1 file changed

+41
-14
lines changed

src/pages/docs/messages/annotations.mdx

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ A given client can contribute to the summary only once per annotation type.
7575
{
7676
"reactions:flag.v1": {
7777
"total": 3,
78-
"clientIds": ["client1", "client2", "client3"]
78+
"clientIds": ["client1", "client2", "client3"],
79+
"clipped": false
7980
}
8081
}
8182
```
@@ -95,11 +96,13 @@ Deleting an annotation removes the `clientId` from the list of clients that cont
9596
"categories:distinct.v1": {
9697
"important": {
9798
"total": 2,
98-
"clientIds": ["client1", "client3"]
99+
"clientIds": ["client1", "client3"],
100+
"clipped": false
99101
},
100102
"urgent": {
101103
"total": 3,
102-
"clientIds": ["client1", "client2", "client3"]
104+
"clientIds": ["client1", "client2", "client3"],
105+
"clipped": false
103106
}
104107
}
105108
}
@@ -120,11 +123,13 @@ Deleting an annotation removes the `clientId` from the list of clients that cont
120123
"status:unique.v1": {
121124
"important": {
122125
"total": 2,
123-
"clientIds": ["client1", "client3"]
126+
"clientIds": ["client1", "client3"],
127+
"clipped": false
124128
},
125129
"urgent": {
126130
"total": 1,
127-
"clientIds": ["client2"]
131+
"clientIds": ["client2"],
132+
"clipped": false
128133
}
129134
}
130135
}
@@ -151,15 +156,19 @@ Deleting an annotation removes all contributions made by that `clientId` for tha
151156
"client1": 3,
152157
"client2": 2
153158
},
154-
"totalUnidentified": 2
159+
"totalUnidentified": 2,
160+
"clipped": false,
161+
"totalClientIds": 2
155162
},
156163
"option-b": {
157164
"total": 4,
158165
"clientCounts": {
159166
"client1": 2,
160167
"client3": 1
161168
},
162-
"totalUnidentified": 1
169+
"totalUnidentified": 1,
170+
"clipped": false,
171+
"totalClientIds": 2
163172
}
164173
}
165174
}
@@ -350,26 +359,31 @@ The summary will be included in a `summary` field nested within the message's `a
350359
},
351360
"reactions:flag.v1": {
352361
"total": 3,
353-
"clientIds": ["client1", "client2", "client3"]
362+
"clientIds": ["client1", "client2", "client3"],
363+
"clipped": false
354364
},
355365
"categories:distinct.v1": {
356366
"important": {
357367
"total": 2,
358-
"clientIds": ["client1", "client3"]
368+
"clientIds": ["client1", "client3"],
369+
"clipped": false
359370
},
360371
"urgent": {
361372
"total": 3,
362-
"clientIds": ["client1", "client2", "client3"]
373+
"clientIds": ["client1", "client2", "client3"],
374+
"clipped": false
363375
}
364376
},
365377
"status:unique.v1": {
366378
"important": {
367379
"total": 2,
368-
"clientIds": ["client1", "client3"]
380+
"clientIds": ["client1", "client3"],
381+
"clipped": false
369382
},
370383
"urgent": {
371384
"total": 1,
372-
"clientIds": ["client2"]
385+
"clientIds": ["client2"],
386+
"clipped": false
373387
}
374388
},
375389
"voting:multiple.v1": {
@@ -379,21 +393,34 @@ The summary will be included in a `summary` field nested within the message's `a
379393
"client1": 3,
380394
"client2": 2
381395
},
382-
"totalUnidentified": 2
396+
"totalUnidentified": 2,
397+
"clipped": false,
398+
"totalClientIds": 2
383399
},
384400
"option-b": {
385401
"total": 4,
386402
"clientCounts": {
387403
"client1": 2,
388404
"client3": 1
389405
},
390-
"totalUnidentified": 1
406+
"totalUnidentified": 1,
407+
"clipped": false,
408+
"totalClientIds": 2
391409
}
392410
}
393411
}
394412
```
395413
</Code>
396414

415+
### Large summaries <a id="large-summaries"/>
416+
417+
If many clients publish the same annotation to the same message, the list of client IDs in that annotation summary will get clipped in order to keep the event size within the maximum message size.
418+
419+
When a summary is clipped:
420+
- The `total` property shows the total number of annotations as expected, but the `clientIds` property will contain only a partial list of client IDs.
421+
- The `clipped` property is set to `true`.
422+
- For the `multiple` annotation type, use the `totalClientIds` property to determine the total number of clients that have published the annotation. For the other annotation types this is equal to `total`.
423+
397424
## Subscribe to individual annotation events <a id="individual-annotations"/>
398425

399426
It is also possible to subscribe to individual annotation events, rather than annotation summaries. These are the emitted when [publishing](#publish) or [deleting](#delete) an annotation.

0 commit comments

Comments
 (0)