Azure / azure-iot-sdk-csharp

A C# SDK for connecting devices to Microsoft Azure IoT services
Other
466 stars 493 forks source link

[PCL Device Client] Support MQTT protocol #30

Closed tameraw closed 7 years ago

tameraw commented 7 years ago

From @stephannielsen on October 20, 2016 8:46

Hi,

is MQTT support planned for the PCL version of the client SDK? If yes, when? If no, why? Technical issues?

Copied from original issue: Azure/azure-iot-sdks#881

tameraw commented 7 years ago

From @kierepka on October 21, 2016 18:47

this same for UWP..

tameraw commented 7 years ago

From @olivierbloch on October 25, 2016 18:38

Hi @stephannielsen , @kierepka We are making progress regarding this one. Work is in progress to make the DotNetty library (that's the one we are using for MQTT support) support UWP and PCL, which means we will be able to pick this one up and hopefully publish a Nuget package for the SDK that will support PCL and UWP. Stay tuned. PS: if you are curious to track the work in progress on DotNetty, it's happening here: https://github.com/nayato/DotNetty/tree/coreclr

WillooWisp commented 7 years ago

What's the progress on MQTT support for .NET Core? It still says not supported when I try to use the DeviceClient with TransportType.Mqtt.

olivierbloch commented 7 years ago

Hi @WillooWisp We are testing the latest updates we recently pushed to the repository to support .Net Standard 1.3, meaning the library can be used on most .Net platforms including .Net Core. We will publish new NuGet packages once we are sure things work well. But in the meantime you should be able to clone the repo and check out the new NetStandard lib. Feedback more than welcome!

WillooWisp commented 7 years ago

NetCore.zip Hi, @olivierbloch

That is what I guessed. I did have problems referencing the NetStandard libraries in my .NET Core project though, it complained about missing files when running app, e.g. the AMQP assembly.

But I did get it working by creating my own NetCore project files, see attached files.

I also fixed an error in the MqttTransportHandler (see code below), and now it works receiving and sending messages over Mqtt, good work from .NET Core.

Uploading blobs etc, is that something that will be included as well for .NET Core? Using only http as transport or Mqtt as well?

`#if !NETSTANDARD1_3 this.serverAddress = Dns.GetHostEntry(this.hostName).AddressList[0];

else

    // var ipAddresses = (await Dns.GetHostAddressesAsync(this.hostName))[0];
this.serverAddress = (await Dns.GetHostAddressesAsync(this.hostName))[0];

endif`

CIPop commented 7 years ago

We are removing PCL support and will instead focus on supporting the NetStandard for cross-plat code: #138 .