public static void mqttSubscriber() ( // create client instance MqttClient client = new MqttClient(IPAddress.Parse(MQTT_BROKER_ADDRESS)); // register to message received client.MqttMsgPublishReceived += client_MqttMsgPublishReceived; string clientId = Guid.NewGuid().ToString(); client.Connect(clientId); // subscribe to the topic "/home/temperature" with QoS 2 client.Subscribe(new string[] { "/home/temperature" }, new byte[] { MqttMsgBase.QOS_LEVEL_EXACTLY_ONCE }); } static void client_MqttMsgPublishReceived(object sender, MqttMsgPublishEventArgs e) { // handle message received }
I am trying to use the M2Mqtt Library written by Paolo which I downloaded from codeplex.
I extracted the library and added M2Mqtt as a Project to Solution Explorer.
In my main project I have added the code listed above.
I am getting an error saying MqttClient not found am I missing a directive or a reference?
This is the first time I have tried adding a library and I'm guessing I'm not doing it right, can someone point me in the right direction?
Thanks