Пример #1
0
        static void Main(string[] args) {
            var client = new MqttClient("localhost", "whatter");
            client.Connect();

            var topicObservable = client.Observe<String, AsciiPayloadConverter>("Nmqtt_quickstart_topic",
                                                                                MqttQos.AtLeastOnce);
            topicObservable.Subscribe(
                msg => Console.WriteLine(String.Format("Msg Received on '{0}' is '{1}'", msg.Topic, msg.Payload)));
            topicObservable.Subscribe(
                msg => Console.WriteLine(String.Format("Second Msg Received on '{0}' is '{1}'", msg.Topic, msg.Payload)));


            Console.ReadKey();
        }
Пример #2
0
        static void Main(string[] args)
        {
            var client = new MqttClient("localhost", "whatter");

            client.Connect();

            var topicObservable = client.Observe <String, AsciiPayloadConverter>("Nmqtt_quickstart_topic",
                                                                                 MqttQos.AtLeastOnce);

            topicObservable.Subscribe(
                msg => Console.WriteLine(String.Format("Msg Received on '{0}' is '{1}'", msg.Topic, msg.Payload)));
            topicObservable.Subscribe(
                msg => Console.WriteLine(String.Format("Second Msg Received on '{0}' is '{1}'", msg.Topic, msg.Payload)));


            Console.ReadKey();
        }