ostrio:user-status

v1.0.1Published 7 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

Meteor user status

Reactively setup user's [on|off]line and idle status into Meteor.user().profile.online, returns Boolean value. This package is meant to work only within accounts-base package, when users will login/logout.

Install:

meteor add ostrio:user-status

ES6 Import:

1import { UserStatus } from 'meteor/ostrio:user-status';

Usage

Simply add and use with accounts-base and accounts-password packages, ostrio:user-status will work silently behind it in the background, - doesn't require any setting up.

ReactiveVar UserStatus.status can be used to identify current user's status

1import { UserStatus } from 'meteor/ostrio:user-status';
2UserStatus.status.get(); // One of offline, online, idle

Session UserStatusIdle can be used to identify if user currently is idle

1Session.get('UserStatusIdle'); // Boolean true when user is idle

Updated user's object

1{
2  username: String,
3  emails: [Object],
4  createdAt: Date,
5  updatedAt: Date,
6  profile: {
7    location: {
8      ip: String     //-> Current or last used user's IP
9    },
10    online: Boolean, //-> Is user online
11    idle: Boolean,   //-> Is user online but idle
12    lastLogin: Date  //-> Current or last login time
13  },
14  connection: String //-> Current or last used DDP Connection ID
15};

Idle Status

Why idle?: Some apps require your constant attention. Such apps often include games, media players, anything that is CPU/battery intensive, and so on. For these kinds of apps, it may be important (as well as user-friendly) to do something when a user is no longer actively interacting with your app.

To control idle status for current client use - Session.get('UserStatusIdle').

Support this project:

This project can't be possible without ostr.io.

By using ostr.io you are not only protecting domain names, monitoring websites and servers, using Prerendering for better SEO of your JavaScript website, but support our Open Source activity, and great packages like this one are available for free.