Skip to content

How can I access my _id client-side? #49

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

Open
espoal opened this issue Jan 20, 2015 · 2 comments
Open

How can I access my _id client-side? #49

espoal opened this issue Jan 20, 2015 · 2 comments
Labels

Comments

@espoal
Copy link

espoal commented Jan 20, 2015

Very nice package. I'm trying to use it but I've met some problems, because I'm just so noob.

If I'm an anonymous user, how can I get my _id?

I can access the _id collections, but how do I pick mine?

@riaan53
Copy link

riaan53 commented Jan 21, 2015

On the client you can just use: Meteor.default_connection._lastSessionId;

All communication to the server will have a connection _id, ip, user agent and so on:

Meteor.methods({
    getConnectionId: function () {
        if (!!this.connection) {
            return [this.connection.id, this.connection.clientAddress];
        }
    }
})

@espoal
Copy link
Author

espoal commented Jan 21, 2015

that works like a charm, excellent package.

I spent a lot of time reading your code and it really helped this noob to learn 👍

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

No branches or pull requests

3 participants