Best way to Fetch connectionState
from 1000's of devices. Currently there is not that much devices, but need an efficient solution.
Based on my understanding, currently I can fetch connectionState
using
Queries(select * from devices)
or registryManager.GetDevicesAsync(100);
-- these methods are not real time when querying for 1000's of devices, or wont be efficient when number of devices increase.Please Suggest some ways and also correct me if I am wrong about any of the above.
ConnectionState field is only suggested to use during development and debugging not in the product solution.
And there is a limitation of retrieving connectionState because the Maximum number of device identities returned in a single call is 1000.
If your IoT solution needs to know if a device is connected, you should implement the heartbeat pattern.
Since considering the overhead of heartbeat that you concerned, you can set a smaller timeout using this API: DeviceClient.OperationTimeoutInMilliseconds
.
This pattern achieves the same result as maintaining a device connection state registry using the heartbeat pattern, while being more efficient.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With