예제 #1
0
        public void HandleNotify(IDictionary <string, string> headers, string body)
        {
            GenaNotifyResponse response = NotifyParser.Parse(headers, body);

            IEnumerable <GenaSubscription> subs = Subscriptions
                                                  .Where(x => x.Id == response.SubscriptionId)
                                                  .Select(x => x as GenaSubscription);

            foreach (GenaSubscription genaSubscription in subs)
            {
                genaSubscription?.FireOnNotify(response);
            }
        }
예제 #2
0
        public GenaNotifyResponse Parse(IDictionary <string, string> headers, string body)
        {
            headers = new Dictionary <string, string>(headers, StringComparer.OrdinalIgnoreCase);

            GenaNotifyResponse response = new GenaNotifyResponse
            {
                NTS            = headers["NTS"],
                SubscriptionId = headers["SID"],
                SequencyNumber = int.Parse(headers["SEQ"]),
                Values         = ParseBody(body)
            };

            return(response);
        }
예제 #3
0
 public void FireOnNotify(GenaNotifyResponse response)
 {
     LastOnNotify = response;
     OnNotify?.Invoke(this, response);
 }