/// <summary> /// Unregister a client for a callback notification when one or more Ups properties change /// </summary> public void Unregister() { IManagementCallback callbackChannel = OperationContext.Current.GetCallbackChannel <IManagementCallback>(); if (ServiceRuntime.Instance.ClientCallbackChannels.Contains(callbackChannel)) { ServiceRuntime.Instance.ClientCallbackChannels.Remove(callbackChannel); } }
public void SubscribeNotifications() { IManagementCallback callback = OperationContext.Current.GetCallbackChannel <IManagementCallback>(); string sessionId = OperationContext.Current.SessionId; if (callback != null && clients.TryAdd(sessionId, callback)) { if (clients.Count == 1) { timer = new System.Threading.Timer(state => BroadcastEvent(DateTime.UtcNow.ToString())); timer.Change(500, 1000); } } else { throw new FaultException("Failed to create client subscription."); } }