Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add visitors to UsersSessions #20

Closed
wants to merge 3 commits into from

Conversation

lmachens
Copy link

Usecase: Publish the number of visitors.

Example:

// percolatestudio/publish-counts
const countVisitors = new Counter('visitors', UsersSessions.find({visitor: true}));

Meteor.publish('visitors', function() {
  return countVisitors;
});

Visitors (without userId) are identified by their connection.id.

@lmachens lmachens changed the title Users sessions visitors Add visitors to UsersSessions Feb 28, 2017
@lmachens
Copy link
Author

lmachens commented Mar 8, 2017

@rodrigok any feedback?

@sampaiodiego
Copy link
Contributor

I'm sorry for the very late response.

Just so you know, I've changed the API to support visitors.. Now on the client side we're doing like this to track a visitor's connection: https://github.com/RocketChat/Rocket.Chat/blob/develop/packages/rocketchat-livechat/.app/imports/client/visitor.js#L163

And on the server side we have this callback to receive status changes and update according collections: https://github.com/RocketChat/Rocket.Chat/blob/develop/packages/rocketchat-livechat/server/visitorStatus.js#L3

@lmachens
Copy link
Author

lmachens commented Sep 6, 2018

I am not sure how your solution works.
We have a online users and visitors count and use UsersSessions.find({ visitor: true }).count() which is a very simple solution.
How can I get the number of visitors with the metadata callback?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants