예제 #1
0
 public async void SendNewSessionNoticeAsync(ClientConnection connection)
 {
     try
     {
         pushNotificationsService.SendNewSessionNoticeAsync(connection);
         var clientConnections = connectionsService
                                 .GetUserClientConnections(connection.UserId.GetValueOrDefault())?
                                 .Where(opt => opt != connection)?.ToList();
         if (!clientConnections.IsNullOrEmpty())
         {
             NewSessionNotice notice = new NewSessionNotice(new SessionVm
             {
                 AppName    = connection.CurrentToken.AppName,
                 DeviceName = connection.CurrentToken.DeviceName,
                 IP         = connection.ClientIP.ToString(),
                 OSName     = connection.CurrentToken.OSName,
                 TokenId    = connection.CurrentToken.Id.GetValueOrDefault()
             });
             await SendNoticeToClientsAsync(clientConnections, notice).ConfigureAwait(false);
         }
     }
     catch (Exception ex)
     {
         Logger.WriteLog(ex);
     }
 }