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

Mark users as online or offline. #5

Open
ekryski opened this issue Mar 19, 2016 · 7 comments
Open

Mark users as online or offline. #5

ekryski opened this issue Mar 19, 2016 · 7 comments
Labels

Comments

@ekryski
Copy link
Contributor

ekryski commented Mar 19, 2016

Currently we need to hook into the socket to mark as user online when:

  • They connect & authenticate

and offline when:

  • When the socket disconnects
  • When they logout
  • When they haven't been authenticated or done anything for a while (ie. token expires maybe?)
@ghost
Copy link

ghost commented May 19, 2016

Is there a way, when they authenticate, to get the socket id on which it has happened ? This way, we could have an array of socket id on which the user is currently connected (and if the array is empty, then the user isn't connected anywhere).

@eddyystop
Copy link
Contributor

Marshall mentioned that feather-authenticate v1 now has auth.on('create', ...) and auth.on('remove', ...)?

@daffl
Copy link
Member

daffl commented Jan 9, 2017

It has app.on('login') and app.on('logout') (which emits some additional information like the connection and request/response object if available).

@subodhpareek18
Copy link

subodhpareek18 commented Oct 23, 2017

@daffl app.on('logout') seems to not be generating for rest provider. app.on('login') seems to be generating for both socket io and rest

@daffl
Copy link
Member

daffl commented Oct 23, 2017

For REST the user has to explicitly call app.logout() since there is no other way to tell. In Socket.io the logout event will also be sent on socket disconnection.

@boustanihani
Copy link

Could someone please paste the code needed to hack into socket.io for listing all user connections?

@daffl
Copy link
Member

daffl commented Apr 23, 2018

The best (and not so hacky) way to get all connections is to combine all event channels and list those connections:

app.channel(app.channels).connections.forEach(connection => {});

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

5 participants