问题描述
如何检查活跃用户"的数量,即在任何给定时间在 Dash 网络应用程序中在浏览器中打开网页的用户数量?
How would one check the number of "active users", i.e. number of users having the web page open in browser at any given time in a Dash web application?
推荐答案
有多种方法可以实现这一点.
There are a number of ways to achieve this.
首先,更强大的方法是利用您可能已经设置的身份验证服务,以便正确授予用户权限(对令牌服务的请求将识别每个用户).在此之后,您可以通过将条目插入后端数据库来记录初始站点负载.
Firstly the more robust approach would be to leverage the auth service you probably already setup so that users are correctly permissioned (a request to a token service would identify each user). After this you can record the initial site load by inserting an entry into a backend database.
您当然不需要使用身份验证服务,您可以只记录用户的 IP 地址并插入到数据库中
You don't need to use an auth service of course you could just record the users IP address and insert into the database
如果您想知道在任何给定时间谁在使用您的网络应用程序,那么一种方法是添加一个间隔计时器回调,它将这些条目与访问时间一起添加到数据库中
If you wanted to know who is using your web app at any given time then one approach would be to add an interval timer callback which would add these entries to the database along with the access time
这篇关于如何查看 Dash 应用中的活跃用户数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!