且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何查看 Dash 应用中的活跃用户数量?

更新时间:2023-12-02 15:01:10

有多种方法可以实现这一点.

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