Before we create a controller, we need to update our sensor and actuator projects. They need to search their brokers for available thing registries and register themselves with them. Since the process is the same for both the sensor and the actuator, only changes to the sensor project will be presented here.
A thing registry client is made available in the Waher.Networking.Provisioning NuGet (or the Waher.Networking.Provisioning.UWP NuGet). It ties into the other XMPP libraries presented so far. We begin by defining a variable for it:
private ThingRegistryClient registryClient = null;
Once the XMPP client establishes a connection, we call a new method called RegisterDevice. We will define this function to be asynchronous:
Task.Run(this.RegisterDevice);
Or:
await this.RegisterDevice();