Total number of live sessions on GAE
Is there a way to count total number of active sessions (e.g. in 10 minutes) on Google App Engine (Python)?
I want to show something on frontpa开发者_JAVA百科ge like, This site currently haz 200 people online
Considering the distributed nature of GAE, I don't think you can do this directly.
You can store visits in the database (with timestamp) and query this (use a cookie to check if a user is already counted, avoid writing on each request!).
Alternatively, you can use some external service that uses included javascript or image that counts this for you, much like how analytics works.
精彩评论