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); }
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); }
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); }
public bool Remove(NetEventIO client) { lock (MUTEX) return(this.subscriptions.Remove(client)); }
public void Add(NetEventIO client) { lock (MUTEX) this.subscriptions.Add(client); }