Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

(sample): Device streaming sample improvements and fixes #173

Merged
merged 1 commit into from
Dec 10, 2020

Conversation

vinagesh
Copy link
Contributor

@vinagesh vinagesh commented Dec 10, 2020

Updated the sample with some improvements

@@ -16,6 +16,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.29.0-preview-*" />
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.32.0-preview-001" />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgraded sample to use the latest version where this sample will work for net 5.0 as well

@@ -44,6 +44,8 @@ public async Task RunSampleAsync()

var receiveResult = await stream.ReceiveAsync(receiveBuffer, cts.Token).ConfigureAwait(false);
Console.WriteLine($"Received stream data: {Encoding.UTF8.GetString(receiveBuffer, 0, receiveResult.Count)}");

await stream.CloseAsync(WebSocketCloseStatus.NormalClosure, "Streaming completed", new CancellationToken());
Copy link
Contributor Author

@vinagesh vinagesh Dec 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sample throws an exception without this


using ServiceClient serviceClient = ServiceClient.CreateFromConnectionString(s_connectionString, s_transportType);
var sample = new DeviceStreamSample(serviceClient, s_deviceId);
// Parse application parameters
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding command line arguments for inputs

[Option(
't',
"TransportType",
Default = TransportType.Amqp,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we default to MQTT?

Copy link
Contributor Author

@vinagesh vinagesh Dec 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TransportType enum in our service client does not have MQTT.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, good point.

@vinagesh vinagesh merged commit 7aa6ca0 into master Dec 10, 2020
@vinagesh vinagesh deleted the vinagesh/ds branch December 10, 2020 19:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants