Skip to content

Commit 223c11c

Browse files
committed
examples/annotations: update functionality of channelName and namespace
1 parent 43e3aa9 commit 223c11c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

examples/pub-sub-message-annotations/javascript/src/ably.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function getClient(): Ably.Realtime {
1818

1919
// Returns the configured channel with all annotation modes enabled
2020
export function getChannel() {
21-
return getClient().channels.get(channelName, {
21+
return getClient().channels.get(`annotation:${channelName}`, {
2222
modes: ['PUBLISH', 'SUBSCRIBE', 'ANNOTATION_PUBLISH', 'ANNOTATION_SUBSCRIBE'],
2323
});
2424
}

examples/pub-sub-message-annotations/javascript/src/components/summary.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,15 +242,15 @@ export function updateAnnotationSummary(message: MessageSummary) {
242242
}
243243

244244
sectionsContainer.innerHTML = '';
245-
const hasAnnotations = annotationTypes.some((type) => message.summary && message.summary[`${annotationNamespace}:${type.key}`]);
245+
const hasAnnotations = annotationTypes.some((type) => message.annotations.summary && message.annotations.summary[`${annotationNamespace}:${type.key}`]);
246246

247247
if (!hasAnnotations) {
248248
sectionsContainer.appendChild(createEmptyAnnotationSummaryContentElement());
249249
return;
250250
}
251251

252252
for (const { key } of annotationTypes) {
253-
const entry = message.summary[`${annotationNamespace}:${key}`];
253+
const entry = message.annotations.summary[`${annotationNamespace}:${key}`];
254254
if (!entry) {
255255
continue;
256256
}

examples/pub-sub-message-annotations/javascript/src/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export const urlParams = new URLSearchParams(window.location.search);
22
export const clientId = urlParams.get('clientId') || 'user2';
3-
export const channelName = urlParams.get('name') || 'mutable:pub-sub-message-annotations';
4-
export const annotationNamespace = 'my-annotations';
3+
export const annotationNamespace = 'annotation';
4+
export const channelName = urlParams.get('name') || `${annotationNamespace}:pub-sub-message-annotations`;
55

66
export const annotationTypes = [
77
{ key: 'total.v1', color: 'blue', label: 'Total' },

0 commit comments

Comments
 (0)