From 2179417664e9a9313769ad60ec65279d2f0316f1 Mon Sep 17 00:00:00 2001 From: FZambia Date: Mon, 2 Sep 2024 12:20:57 +0300 Subject: [PATCH] use separate field for real channel --- src/centrifuge.ts | 5 +++-- src/types.ts | 12 +++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/centrifuge.ts b/src/centrifuge.ts index 048e8063..3789acb7 100644 --- a/src/centrifuge.ts +++ b/src/centrifuge.ts @@ -1699,10 +1699,11 @@ export class Centrifuge extends (EventEmitter as new () => TypedEventEmitter; + // publicationChannel may be used to find out the real channel of publication, in most cases it + // matches channel field, but when wildcard subscriptions are used it may be different and contain + // a channel to which publication was published, thus differ from channel field (which is always a + // channel to which client subscribed to). + publicationChannel: string; } export interface ClientInfo { @@ -260,7 +265,7 @@ export interface UnsubscribedContext { } export interface ServerPublicationContext { - // channel from which publication was received. + // subscription channel from which publication was received. channel: string; // data contains publication payload. data: any; @@ -273,6 +278,11 @@ export interface ServerPublicationContext { offset?: number; // tags is an extra key-value attached to publication, tags may be set when calling server publish API. tags?: Record; + // publicationChannel may be used to find out the real channel of publication, in most cases it + // matches channel field, but when wildcard subscriptions are used it may be different and contain + // a channel to which publication was published, thus differ from channel field (which is always a + // channel to which client subscribed to). + publicationChannel: string; } export interface ServerJoinContext {