How to show online users with ajax

后端 未结 2 1322
旧时难觅i
旧时难觅i 2021-01-01 02:50

I\'m want to show all the users that are online, in real-time on my website. Not sure how to go about this though. It can\'t be hard to add new users once they log in, but I

2条回答
  •  抹茶落季
    2021-01-01 03:32

    You can periodically make an ajax call to the server and check how many have logged in currently. You could use setInterval for setting up a timer to fire the ajax request. The response would contain the no. of users active currently.

提交回复
热议问题