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

Potential disconnect event needed for anonymous users #44

Open
rclai opened this issue Nov 27, 2014 · 4 comments
Open

Potential disconnect event needed for anonymous users #44

rclai opened this issue Nov 27, 2014 · 4 comments

Comments

@rclai
Copy link

rclai commented Nov 27, 2014

The connectionIdle event triggers instead.

Is this a browser issue?

Edit: Oh, if I'm logged in, and I close the window tab, then the connectionLogout event triggers, but if I'm not logged in and I close the browser, connectionIdle triggers.

Should there be a connectionClose event, given that idling is arguably qualitatively different than closing?

@mizzao
Copy link
Collaborator

mizzao commented Nov 29, 2014

Interesting that connectionIdle is triggered at all. Sounds like a bug that I should probably look into.

The connection is still deleted, though; is that right?

@tsega
Copy link

tsega commented Jan 23, 2015

@mizzao I have a similar problem, closing browser for either authenticated or anonymous users doesn't do anything. However, for authenticated users, closing tabs triggers the connectionLogout event but not for anonymous users.

To overcome that, I looked for a solution to set non-logged in users as logged in users temporarily so that the connectionLogout event would fire. I found the accounts-guest package that logs in anonymous users but I'm having problem with that, it's not working at all.

I'm going through all of this, just to see who's viewing a certain page/route for both types of users. Any suggestions?

@mizzao
Copy link
Collaborator

mizzao commented Feb 18, 2015

Okay, I see the problem here; the connectionLogout is not triggered unless there is a userId, while the connectionIdle triggers regardless and should behave consistently:

https://github.com/mizzao/meteor-user-status/blob/master/status.coffee#L133

What do you guys think should happen in this case? Both events should be triggered?

@mizzao mizzao added the bug label Feb 18, 2015
@mizzao mizzao changed the title connectionLogout event not triggering when closing browser tab connectionLogout event not triggered for anonymous users Feb 18, 2015
@mizzao mizzao added enhancement and removed bug labels Feb 18, 2015
@mizzao mizzao changed the title connectionLogout event not triggered for anonymous users Potential disconnect event needed for anonymous users Feb 18, 2015
@mizzao
Copy link
Collaborator

mizzao commented Feb 18, 2015

Actually, I just looked at this again and it is by design. A connectionLogout is only triggered when a user's authenticated connection either logs out or disconnects. If the user pushes the "Log Out" button, there is no second connectionLogout when their now-unauthenticated connection disconnects.

I don't think connectionIdle should be triggered regardless, but I could look into it.

Can you guys clarify what you are doing that would need to watch unauthenticated users disconnect?

In @tsega's use case, we could implement something similar to #28 with a weak dependency on Iron Router.

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

No branches or pull requests

3 participants