I have a page in Flask that will be requested by a client every couple of seconds, If the client doesn’t request the page after couple of minutes I want to flag this client as disconnected and will run some code. I don’t want to use web-sockets in this case. I was thinking of implementing this by creating a list of clients with ‘last activity’ variable that will be updated every time the client request the page, a thread will check the list every couple of minutes if the ‘last activity’ of the client is too old.
However I’m not sure it is the best and most efficient way of doing that without using web-sockets (maybe by using flask built-in code?).
Is it the best way? If not, Please share your suggestion for a better code design.
Thanks.