Skip to content
This repository was archived by the owner on Aug 23, 2025. It is now read-only.

Xerdi/meteor-presence

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Meteor Presence

A simple wrapper for the user-status package.

Installation

Add the package to your project:

meteor add xerdi:presence

Usage

The service is automatically started on login and stopped on logout.

Client Side Functions

It can be started/stopped manually and there is a way to get the status of the service:

import {Presence} from 'meteor/xerdi:presence';
import log from 'meteor/xerdi:logging';

log.info(`Presence status ${Presence.status()}`);

Presence.start();
// OR
Presence.stop();

Schema Definition

In order for the service to work the user needs an additional schema.

import {Meteor} from "meteor/meteor";
import SimpleSchema from "simpl-schema";

const UsersStatusSchema = new SimpleSchema({
    lastLogin: {
        type: Object,
        optional: true,
    },
    'lastLogin.date': {
        type: Date,
        optional: true,
    },
    'lastLogin.ipAddr': {
        type: String,
        optional: true,
    },
    'lastLogin.userAgent': {
        type: String,
        optional: true,
    },
    'idle': {
        type: Boolean,
        optional: true,
    },
    'lastActivity': {
        type: Date,
        optional: true,
    },
    'online': {
        type: Boolean,
        optional: true,
    },
});
Meteor.users.schema = new SimpleSchema({
    // ... other fields
    status: {
        type: UsersStatusSchema,
        optional: true
    }
});
Meteor.users.attachSchema(Meteor.users.schema);

About

Plugin for tracking user presence

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published