Amqp protocol is not supported on Universal Windows App

I was surprised to learn that AMQP protocol is not supported on Universal Windows Platform with Azure Devices Client libraries.I was getting this message “Amqp protocol is not supported” when trying to connect to the Microsoft Azure IoT Hub through the UWA app. This applies to MQTT as well. Only thing that’s supported right now is HTTP.

The nuget package Microsoft.Azure.Devices.Client lists both AMQP and MQTT libraries as dependencies. But its not supported on the Universal Windows platform. Weird.

Workaround:

This threw “Amqp protocol is not supported” :

__thisClient = DeviceClient.Create(__azureIoTHubHostname, 
                       new DeviceAuthenticationWithRegistrySymmetricKey(__azureIoTHubDeviceId, __azureIoTHubDeviceKey));

Had to update the line to include the TransportType.HTTP1 parameter:

__thisClient = DeviceClient.Create(__azureIoTHubHostname, 
                       new DeviceAuthenticationWithRegistrySymmetricKey(__azureIoTHubDeviceId, __azureIoTHubDeviceKey),
                       TransportType.Http1);