Preparing our project
We create a new Universal Windows Platform application project, based on the Sensor
project described in chapter 2. This time, we call it SensorMqtt
. We use the same hardware setup and sensor code developed earlier. In this chapter, we will focus on how to publish the information we've sampled on the internet, and how to receive it. We begin by adding a new NuGet package, the Waher.Networking.MQTT.UWP
package. This package contains a simple MQTT client we can use to communicate using the MQTT protocol. We also add the Waher.Runtime.Settings
package introduced in the previous chapter.
Note
For.NET standard, .NET Core, or traditional .NET Framework projects, you can use the Waher.Networking.MQTT
NuGet instead. UWP apps use different libraries and runtime binaries when it comes to communication and encryption. For this reason, it requires a somewhat modified version of the original library.
Selecting an MQTT broker
To use MQTT, you need to decide what MQTT broker you will use...