Exemplo n.º 1
0
        public bool onUnsubscribe(NetEventIO sender, string topicName)
        {
            TopicSubscriptionsCollection value;

            try
            {
                subscriptions.TryGetValue(topicName, out value);
                if (value == null)
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                return(false);
            }

            bool result = value.Remove(sender);

            return(result);
        }
Exemplo n.º 2
0
        public bool onSubscribe(NetEventIO sender, string topicName)
        {
            TopicSubscriptionsCollection value;

            try
            {
                subscriptions.TryGetValue(topicName, out value);
                if (value == null)
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                return(false);
            }

            value.Add(sender);
            return(true);
        }
Exemplo n.º 3
0
        public bool onUnsubscribeAll(NetEventIO client)
        {
            List <string> topics = new List <string>(subscriptions.Keys);
            TopicSubscriptionsCollection value;

            foreach (string topicName in topics)
            {
                try
                {
                    subscriptions.TryGetValue(topicName, out value);

                    value.Remove(client);
                }
                catch (Exception)
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 4
0
 public bool Remove(NetEventIO client)
 {
     lock (MUTEX)
         return(this.subscriptions.Remove(client));
 }
Exemplo n.º 5
0
 public void Add(NetEventIO client)
 {
     lock (MUTEX)
         this.subscriptions.Add(client);
 }