예제 #1
0
 public Task SendDataNotification(DataNotificationType type, Guid userId, object data)
 {
     if (_hubNotificationProxy != null)
     {
         return(_hubNotificationProxy.Invoke("OnDataNotification", type, userId.ToString(), data));
     }
     return(Task.FromResult(0));
 }
예제 #2
0
 private async Task SendNotification(DataNotificationType type, string userId, UserMessageModel message = null)
 {
     await NotificationService.SendDataNotification(new DataNotificationModel
     {
         Data   = message,
         Type   = type,
         UserId = new Guid(userId)
     }).ConfigureAwait(false);
 }
예제 #3
0
        //[AuthorizeLocal]
        public async Task OnDataNotification(DataNotificationType type, string user, object data)
        {
            var notificationModel = new DataNotificationModel
            {
                Type = type,
                Data = data
            };

            if (string.IsNullOrEmpty(user))
            {
                await Clients.All.SendDataNotification(notificationModel);

                return;
            }
            await Clients.User(user).SendDataNotification(notificationModel);
        }