Esempio n. 1
0
 public static UnsubAckPacket RemoveSubscriptions(ISessionState session, UnsubscribePacket packet)
 {
     List<Subscription> subscriptions = session.Subscriptions;
     foreach (string topicToRemove in packet.TopicFilters)
     {
         for (int i = subscriptions.Count - 1; i >= 0; i--)
         {
             if (subscriptions[i].TopicFilter.Equals(topicToRemove, StringComparison.Ordinal))
             {
                 subscriptions.RemoveAt(i);
                 break;
             }
         }
     }
     var ack = new UnsubAckPacket
     {
         PacketId = packet.PacketId
     };
     return ack;
 }
 public static UnsubAckPacket RemoveSubscriptions(ISessionState session, UnsubscribePacket packet)
 {
     foreach (string topicToRemove in packet.TopicFilters)
     {
         session.RemoveSubscription(topicToRemove);
     }
     var ack = new UnsubAckPacket
     {
         PacketId = packet.PacketId
     };
     return ack;
 }