Robert S.
Robert S.

Reputation: 23

Python Flask detect how long a user has been on the page

For my project, I have a virtual currency, which you can get by staying on the page. (every 15 minutes you get 0.1 coins) I did some research, and I did not find anything about it in Flask and I have no clue on how to see how long a user has been on a page. Is there anyone who could help me?

Thanks, Robert S.

Upvotes: 0

Views: 101

Answers (1)

Jürgen Gmach
Jürgen Gmach

Reputation: 6123

There is no direct way as http is stateless.

That means that once a page is loaded, the connection between browser and server gets disconnected.

Maybe there are ways to workaround this limitation, eg by regularly send a message to the server via Javascript or with websockets.

Upvotes: 1

Related Questions