This is not a specific coding question, but more of a best practices advice to a newcomer into the web apps world with years of experience in five-nines telecom software development.
I have an ASP.NET web application that collects data from several embedded (Arduino) devices. The device push data periodically via simple HTTP GET requests. Under normal conditions, each device pushes data once every 30 seconds. However, there is a chance that a device could be lost or connectivity from the device to the server could be lost. I need to detect this condition within 2-3 normal data reporting cycles.
If it was a typical stand-alone C# application, I would start a timer every time I receive data from a device with the expiration set to the maximum timeout duration. If the timer expires, this means I have not heard from the device for too long and I need to trigger an alert (email or something) from my application.
So, the inactivity timer approach seems to be pretty typical for stand-alone always-on applications with non-persistent connections. But what is the right way of doing this in an ASP.NET web app? Can I have timers of this kind running outside of my HTTP request handlers?
I searched for possible solutions, and people seem to have more questions about timing out browser sessions and such. My problem is different in these aspects:
- I have a very light-weight client incapable of session state tracking
- I need to detect inactivity in a timely fashion to alert/alarm the user, who is not interacting with the system until there is an alarm
Thank you for sharing the wisdom.