Skip to content

Commit 0b29a4e

Browse files
committed
fixup! annotations: restructure annotations page to split summaries and individual events
1 parent 847e992 commit 0b29a4e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/pages/docs/messages/annotations.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,10 @@ await channel.annotations.publish(message.serial, {
421421

422422
Subscribe to individual annotation events using the `annotations.subscribe()` method on a channel. To subscribe to individual annotations, you must request the `ANNOTATION_SUBSCRIBE` [mode](/docs/channels/options#modes).
423423

424+
<Aside data-type='note'>
425+
When you provide an explicit `modes` property for a channel, you override the set of [default modes](/docs/channels/options#modes) used for that channel. It is likely that you will be using features other than just annotations, so ensure that you also include the other `modes` that you require.
426+
</Aside>
427+
424428
Annotations delivered to the `annotations.subscribe()` listener will have an `action` of `annotation.create` or `annotation.delete`.
425429

426430
<Code>
@@ -432,7 +436,7 @@ const realtime = new Ably.Realtime({ key: '{{API_KEY}}', clientId: 'my-client-id
432436
// Create a channel in a namespace called `annotations`
433437
// which has message annotations enabled.
434438
// Specify the ANNOTATION_SUBSCRIBE mode to enable annotation subscriptions.
435-
const channel = realtime.channels.get('annotations:example', { modes: ['ANNOTATION_SUBSCRIBE'] });
439+
const channel = realtime.channels.get('annotations:example', { modes: ['ANNOTATION_SUBSCRIBE', ... /* all other modes you need, such as MESSAGE_SUBSCRIBE */] });
436440

437441
await channel.annotations.subscribe((annotation) => {
438442
if (annotation.action === 'annotation.create') {

0 commit comments

Comments
 (0)