I have this web page that sends a start real-time tracking command to GPS devices all over. The way the code is currently written fulfills its purpose as long as the page is actively loaded. However, if the user shuts down the browser or the computer, the device does not receive the stop real-time tracking command since the program is not running.
What I would like to accomplish is to create a script or service that will keep track of when a device needs to stop reporting in the event the user forgot to stop the real time tracking. I want to implement this feature for two reasons. First, the constant (non-stop) reporting becomes a billing issue for the company and second the devices are battery operated and the issue of energy consumption plays a big part.
What I was thinking on doing is implementing an AJAX script that will access the web method at the end of a specific interval but I believe this implementation will not work either. I tried to use the setTimeout() method with Ajax and it did not go very well.
I need some help and I would appreciate any input that would put me back on track with this project?