diff --git a/apps/meteor/app/notifications/server/lib/Notifications.ts b/apps/meteor/app/notifications/server/lib/Notifications.ts index 0ee20a7a70e1..f1f6d46ab13f 100644 --- a/apps/meteor/app/notifications/server/lib/Notifications.ts +++ b/apps/meteor/app/notifications/server/lib/Notifications.ts @@ -3,6 +3,7 @@ import { DDPCommon } from 'meteor/ddp-common'; import { NotificationsModule } from '../../../../server/modules/notifications/notifications.module'; import { Streamer } from '../../../../server/modules/streamer/streamer.module'; +import { api } from '../../../../server/sdk/api'; import { Subscriptions as SubscriptionsRaw, Rooms as RoomsRaw, @@ -41,4 +42,8 @@ notifications.configure({ Settings: SettingsRaw, }); +notifications.streamLocal.on('broadcast', ({ eventName, args }) => { + api.broadcastLocal(eventName, ...args); +}); + export default notifications; diff --git a/apps/meteor/server/modules/notifications/notifications.module.ts b/apps/meteor/server/modules/notifications/notifications.module.ts index af473dbd1bae..8230428e75aa 100644 --- a/apps/meteor/server/modules/notifications/notifications.module.ts +++ b/apps/meteor/server/modules/notifications/notifications.module.ts @@ -49,6 +49,8 @@ export class NotificationsModule { public readonly streamRoomData: IStreamer; + public readonly streamLocal: IStreamer; + public readonly streamPresence: IStreamer; constructor(private Streamer: IStreamerConstructor) { @@ -91,6 +93,7 @@ export class NotificationsModule { }); this.streamUser = new this.Streamer('notify-user'); + this.streamLocal = new this.Streamer('local'); } async configure({ Rooms, Subscriptions, Users, Settings }: IModelsParam): Promise { @@ -446,6 +449,11 @@ export class NotificationsModule { } }); + this.streamLocal.serverOnly = true; + this.streamLocal.allowRead('none'); + this.streamLocal.allowEmit('all'); + this.streamLocal.allowWrite('none'); + this.streamPresence.allowRead('logged'); this.streamPresence.allowWrite('none'); }