예제 #1
0
        private async Task PushNumberOfPostReactions(SetPostReactionViewModel postReaction)
        {
            var connectionID   = NotificationHub.GetConnectionID(postReaction.User.UserName);
            var reactionsCount = _postReactionService.GetReactionCount(postReaction.PostId);

            if (connectionID != null)
            {
                await _notificationHub.Clients.All.SendAsync("ReactionsCount", JsonConvert.SerializeObject(reactionsCount));
            }
        }
예제 #2
0
        private async Task PushNumberOfNotifications(ElanUser user)
        {
            var connectionID       = NotificationHub.GetConnectionID(user.UserName);
            var notificationsCount = await _notificationService.GetNumberOfUnreadNotificationsForUser(user);

            if (connectionID != null)
            {
                await _notificationHub.Clients.Client(connectionID).SendAsync("NotificationsCount", JsonConvert.SerializeObject(notificationsCount));
            }
        }