简体   繁体   中英

How to add a “# users online” feature to Meteor app?

I'm working on a Meteor app and I want to add a feature that would say how many people are on the website at a time, similar to omegle.com where it says "38,000+ online now" or whatever. Is this possible with Meteor? If it is, I have no idea how to execute it, and that's why I'm asking it here. Does anybody know how to do this?

You can use presence package for that purpose, see https://atmospherejs.com/package/presence . It provides the live data on the user state. For example, the easiest way to get the number of online users is:

Presences.find({online: true}).count();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM