Beispiel #1
0
        public async Task SubscribeAsync(string topic, QualityOfServiceLevelType qos, Action <string, string, byte[]> action)
        {
            Dictionary <string, QualityOfServiceLevelType> dict = new Dictionary <string, QualityOfServiceLevelType>();

            dict.Add(topic, qos);
            dispatcher.Register(topic, action);
            SubscribeMessage msg = new SubscribeMessage(session.NewId(), dict);
            await channel.SendAsync(msg.Encode());
        }
Beispiel #2
0
        /// <summary>
        /// Register a topic that already has a subscription.
        /// </summary>
        /// <param name="topic"></param>
        /// <param name="action"></param>
        public void RegisterTopic(string topic, Action <string, string, byte[]> action)
        {
            Uri uri = new Uri(topic.ToLowerInvariant());

            dispatcher.Register(uri.ToString(), action);
        }