0

In my project I use Microsoft.Azure.Device library to send message Cloud to Device. I can get feedback information about send status. In ServiceClient object there is a GetFeedbackReceiver method. Everything works perfect. But I want also check status of sending message from Device to Cloud. In object DeviceClient I don't see any method to receive feedback. What is the best solution to check that device has sent a message? Catch exception on sending method or is there better solution?

I saw in sample application to send D2C message in node.js: https://github.com/Azure/azure-iot-sdks/blob/master/node/device/samples/simple_sample_device.js that method client.sendEvent(message, printResultFor('send')) gives a feedback. Is this functionality missed in c# implementation?

Bart
  • 1
  • 1
  • 3

1 Answers1

1

DeviceClient.SendEvent() returns an IAsyncAction, which represents an asynchronous operation without a result type. Kind of like a Task. This means the only thing you can do is await the result. You will know if sending the message failed if an exception is thrown. Otherwise it succeeded.

juunas
  • 54,244
  • 13
  • 113
  • 149