public IWampTopic CreateTopicByUri(string topicUri, bool persistent) { WampTopic wampTopic = CreateWampTopic(topicUri, persistent); IDictionary <string, WampTopic> casted = mTopicUriToSubject; casted.Add(topicUri, wampTopic); RaiseTopicCreated(wampTopic); return(wampTopic); }
private WampTopic CreateWampTopic(string topicUri, bool persistent) { WampTopic topic = new WampTopic(topicUri, persistent); // Non persistent topics die when they are empty :) if (!persistent) { topic.TopicEmpty += OnTopicEmpty; } return(topic); }
public IWampTopic GetOrCreateTopicByUri(string topicUri, bool persistent) { // Pretty ugly. bool created = false; WampTopic result = mTopicUriToSubject.GetOrAdd(topicUri, key => { WampTopic topic = CreateWampTopic(topicUri, persistent); created = true; return(topic); }); if (created) { RaiseTopicCreated(result); } return(result); }