Dan Young
Dan Young

Reputation: 137

Azure IoT Messages - Requesting Data Best Practices

I have an ASP.NET Core website in the Azure Cloud which can send messages to a simulated IoT device (console app) that sits on my private network.

I want to be able to respond to the Cloud-to-Device website generated message with data from my private network device, not just a delivery acknowledgement.

The two options I can think of are:

Has anyone experience in doing this? If so, what other options do I have and what do people recommend as best practice?

Thanks.

Upvotes: 0

Views: 121

Answers (1)

Pete
Pete

Reputation: 1867

You can use direct method invocation from the Cloud (MS tutorial) - calling a method on your simulated device and waiting for a response, but this will only work for small payloads (up to 8KB, I think)

For larger payloads, I'd suggest sending a Cloud to Device message containing a GUID that identifies the message, then sending a file back to BLOB storage (see this Microsoft tutorial), using the GUID as a filename, and then having the IoT hub send a notification event to your cloud code when the file is delivered. The GUID allows you to tie the response back to the initial request.

Upvotes: 1

Related Questions