Notification System used to send some message to specific users.But global event not avaible in js file.

code in js

        abp.event.on('abp.notifications.received', function (userNotification) {
        console.log("userNotification", userNotification);
    });

code in application

    public class NotificationTestService : AcsAppServiceBase, INotificationTestService
    {
        private INotificationPublisher _notificationPublisher;
        private readonly IRepository<User, long> _userRepository;

        public NotificationTestService(INotificationPublisher notificationPublisher, IRepository<User, long> userRepository)
        {
            _notificationPublisher = notificationPublisher;
            _userRepository = userRepository;
        }

        public async void NotificationTest()
        {
            string message = "Test Message";

            var currentUser = (await this.GetCurrentUserAsync()).ToUserIdentifier();

            _notificationPublisher.Publish("NotificationTest", new MessageNotificationData(message), severity: NotificationSeverity.Info, userIds: new[] { currentUser });
        }
    }
  1. notification data 1
  2. notification data 2

I found the notification data in database,but event is not trigger in js file .No exception throw. Thank you for your any help.

0 Answers