I would like to keep track of all clients currently on a page in my app. I am basically implementing something similar to user list on Google Doc.
A naive approach would be to send a heartbeat to the server at an interval, when a client is on the page.
As an alternative, I am thinking about implementing the following:
- Once a client connects and it is on that page, push the userId to an array in the db
- Observe the DDP connection with the connection ID
- Pull the userId when the DDP connection is closed
But I don’t know if that is even feasible. Any ideas or a suggestion for a better solution?
Edit
I would like to only track status of users on a certain page. Therefore meteor-user-status won’t suit my needs.
Also I want to track anonymous clients (users who are not logged in)