public string Subscribe() { try { icbs = OperationContext.Current.GetCallbackChannel <ICallBackService>(); subscribers.Add(icbs); Console.WriteLine(icbs.ToString()); return("Successfully subscribed for weather updates!"); } catch (Exception e) { Console.WriteLine(e.Message); return(e.Message); } }
public string Unsubscribe() { try { icbs = OperationContext.Current.GetCallbackChannel <ICallBackService>(); lock (subscribers) { subscribers.Remove(icbs); } return("Successfully unsubscribed!"); } catch (Exception e) { Console.WriteLine(e.Message); return("Something went wrong! Try after some time."); } }
public CallBackController(ICallBackService service) => this.service = service;