public void SendNotifications(string connectionId) { IEnumerable <Notification> userNotifications = NotificationStore.GetNotifications(); var connection = ConnectionStore.GetAllConnections().FirstOrDefault(con => con.ConnectionId == connectionId); if (connection != null) { connection.UpdateNotificationList(userNotifications); } }
/// <summary> /// Send notification message to active clients /// </summary> /// <param name="notificationType">Type of notification</param> /// <param name="logLevel">Log level (UI display)</param> /// <param name="message">Message to display</param> /// <param name="data">Additional details (custom class)</param> public string Notify(string notificationType, INotificationDetail notificationDetail, LogLevel logLevel, IConvertible notificationId = null, bool broadcast = false) { string userName = (broadcast) ? null : UserIdentity.UserName; Notification notification = NotificationStore.AddUpdate(notificationId.ToString(), notificationType, notificationDetail, userName, logLevel); foreach (ConnectionInformation connectionInfo in ConnectionStore.GetAllConnections()) { connectionInfo.Notify(notification); } return(notificationId.ToString()); }
public List <Dictionary <string, object> > GetActiveSessions() { return(ConnectionStore.GetAllConnections().Select(session => new Dictionary <string, object>() { { "UserName", session.UserName }, { "DomainName", session.DomainName }, { "EnvironmentName", session.EnvironmentName }, { "ClientAddress", session.ClientAddress }, //{ "ClientHostName", ServiceMetrics.GetHostName(session.ClientAddress) }, { "ApplicationVersion", session.ApplicationVersion }, { "BrowserVersion", session.BrowserVersion }, { "ConnectedDate", session.ConnectedDate } }).ToList()); }