I have a list of documents in meteor that only authorised users can access. It's kind of like google docs. Is there an easy way to get a list of users which are currently viewing them?
I thought of including a "currentUsers" field in my mongodb object, and push/remove users whenever users view or stop viewing the component. This feels like a strange way to do it since data is persisted and is probably prone to errors since it doesn't exactly represent users currently viewing the component at a moment in time
This stackoverflow question is kind of what I'm looking for, but the answer is a little old, and I'm not sure how to go about using sockjs either. If someone can provide a working example that will be great.
Any help is greatly appreciated!
There are several options:
DIY solution - storing data in Collection
package meteor-user-status https://github.com/mizzao/meteor-user-status
package mrt:spy (which seems to be deprecated, but maybe you can build on top of it) https://atmospherejs.com/mrt/spy
socket.io https://atmospherejs.com/joncursi/socket-io-client
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With