konecty/meteor-user-presence

How can I use this package to call a function on the server when a user is offline?

Closed this issue · 1 comments

When the user is completely offline, meaning not connected to my app through any client (phone, desktop, laptop, etc) I want to run a function on the server.

How can I do that with this package?

you can use the setStatus event and check if the status was changed to offline:

UserPresenceEvents.on('setStatus', (session, status, metadata) => {
  if (status === 'offline') {
  }
})