Exemple #1
0
        /// <summary>
        /// 设置订阅消息topic,还要有回调函数,在此处触发一个事件
        /// </summary>
        /// <param name="topic">订阅的主题</param>
        /// <param name="handler">消息处理函数</param>
        /// <returns>true:增加订阅成功;false:订阅失败</returns>
        public bool AddSubscribeTopic(string topic, HandlerSubscribeMsg handler)
        {
            if (_dictionaryTopicHandlers.ContainsKey(topic))
            {
                return(false);
            }

            _subSocket.Subscribe(topic);
            _dictionaryTopicHandlers[topic] = handler;

            return(true);
        }
Exemple #2
0
 //TODO 需要加topic流程
 private bool SubscribeTopic(string topic, HandlerSubscribeMsg handler)
 {
     subClient.AddSubscribeTopic(topic, handler);
     return(true);
 }
Exemple #3
0
 public static bool AddSubscribe(string topic, HandlerSubscribeMsg handler)
 {
     return(GetInstance().SubscribeTopic(topic, handler));
 }