How to track the number of anonymous users server-side in Meteor?

后端 未结 3 1557
一生所求
一生所求 2021-02-03 11:27

I\'m writing a data-sensitive application in Meteor, and am trying to limit the client access to as much information as possible. Therefore, I want to implement server side a wa

3条回答
  •  無奈伤痛
    2021-02-03 11:56

    For the sake of completeness, it's probably best to combine the two answers above. In other words, do the following:

    • Keep the online status in Meteor.users, as opposed to a separate collection, as in https://github.com/erundook/meteor-profile-online
    • Keep track of disconnections via callback, instead of a heartbeat, as in https://github.com/murilopolese/howmanypeoplearelooking

    This would probably be the canonical way to implement this in Meteor. I've created this as a smart package that you can install with Meteorite: https://github.com/mizzao/meteor-user-status

提交回复
热议问题