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)); } }
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)); } }