3

Are there any significant differences between explicitly opening a connection with DeviceClient at application initialisation or leaving it to open the connection itself when a message is sent?

What I mean by this is:

await deviceClient.OpenAsync(); // in main() etc.
...
await deviceClient.SendEventAsync(message);

Instead of just:

await deviceClient.SendEventAsync(message);

Are there any downsides to the latter? Is a connection held open regardless of how it's opened?

user9993
  • 5,833
  • 11
  • 56
  • 117

1 Answers1

3

There is no advantage of calling DeviceClient.OpenAsync today. For all operations we internally make sure the device connection is opened.

Stefan Wick MSFT
  • 13,600
  • 1
  • 32
  • 51