The Azure IoT SDK allows a method handler to be assigned after setting up a connection string to the Azure IoT hub (such as below).
// Create the device client
deviceClient = DeviceClient.CreateFromConnectionString(hubConnect,
Microsoft.Azure.Devices.Client.TransportType.Mqtt_WebSocket_Only);
// Register the delegate for the print job available direct method
deviceClient.SetMethodHandlerAsync("ClientProcess",
ClientProcess,
null).Wait();
After a random interval, the client process is unable to receive any more notificaitons from the IoT hub. How can the client process determine if the connection to the IoT hub is still valid and able to receive messages when the method handler is set?