All Projects → dburles → meteor-presence

dburles / meteor-presence

Licence: MIT License
👥 Meteor package to help track users' presence

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to meteor-presence

meteor-two-factor
🔐 Two factor authentication package for accounts-password
Stars: ✭ 80 (-9.09%)
Mutual labels:  meteor, meteor-package
svelte-meteor-data
Reactively track Meteor data inside Svelte components
Stars: ✭ 14 (-84.09%)
Mutual labels:  meteor, meteor-package
meteor-reactive-mongo
Reactive server-side MongoDB queries
Stars: ✭ 14 (-84.09%)
Mutual labels:  meteor, meteor-package
meteor-flow-router-map
Meteor package for Flow Router
Stars: ✭ 15 (-82.95%)
Mutual labels:  meteor, meteor-package
Meteor-flow-router-title
Change document.title on the fly within flow-router
Stars: ✭ 23 (-73.86%)
Mutual labels:  meteor, meteor-package
Meteor-logger-file
🔖 Meteor Logging: Store application log messages into file (FS)
Stars: ✭ 24 (-72.73%)
Mutual labels:  meteor, meteor-package
meteor-packages
Client for Meteor Package Server API
Stars: ✭ 14 (-84.09%)
Mutual labels:  meteor, meteor-package
Meteor-Template-helpers
Template helpers for Session, logical operations and debug
Stars: ✭ 35 (-60.23%)
Mutual labels:  meteor, meteor-package
ostrio-analytics
📊 Visitor's analytics tracking code for ostr.io service
Stars: ✭ 14 (-84.09%)
Mutual labels:  meteor, meteor-package
hypersubs
an upgraded version of Meteor subscribe, which helps optimize data and performance!
Stars: ✭ 13 (-85.23%)
Mutual labels:  meteor, meteor-package
Client-Storage
🗄 Bulletproof persistent Client storage, works with disabled Cookies and/or localStorage
Stars: ✭ 15 (-82.95%)
Mutual labels:  meteor, meteor-package
meteor-server-autorun
Server-side Tracker.autorun
Stars: ✭ 36 (-59.09%)
Mutual labels:  meteor, meteor-package
meteor-subscription-scope
Scope queries on collections to subscriptions
Stars: ✭ 20 (-77.27%)
Mutual labels:  meteor, meteor-package
meteor-control-mergebox
Control mergebox of publish endpoints
Stars: ✭ 28 (-68.18%)
Mutual labels:  meteor, meteor-package
Meteor-Cookies
🍪 Isomorphic bulletproof cookie functions for client and server
Stars: ✭ 41 (-53.41%)
Mutual labels:  meteor, meteor-package
Meteor-Mailer
📮 Bulletproof email queue on top of NodeMailer with support of multiple clusters and servers setup
Stars: ✭ 21 (-76.14%)
Mutual labels:  meteor, meteor-package
blaze-integration
Vue integration with Meteor's Blaze rendering engine.
Stars: ✭ 24 (-72.73%)
Mutual labels:  meteor, meteor-package
meteor-computed-field
Reactively computed field for Meteor
Stars: ✭ 18 (-79.55%)
Mutual labels:  meteor, meteor-package
Meteor-logger-mongo
🍃 Meteor Logging: Store application log messages in MongoDB
Stars: ✭ 20 (-77.27%)
Mutual labels:  meteor, meteor-package
flow-router
🚦 Carefully extended flow-router for Meteor
Stars: ✭ 191 (+117.05%)
Mutual labels:  meteor, meteor-package

Meteor Presence

A very simple presence package, to track who's online, etc.

Installation

$ meteor add tmeasday:presence

Usage

Once added to your project, a new Meteor collection called Presences is available.

All active connections are then stored in this collection. A presence document from an authenticated user will contain their user id on the userId field.

NOTE: The package doesn't publish the presences by default, you'll need to do something like:

Meteor.publish('userPresence', function() {
  // Setup some filter to find the users your user
  // cares about. It's unlikely that you want to publish the 
  // presences of _all_ the users in the system.
  
  // If for example we wanted to publish only logged in users we could apply:
  // filter = { userId: { $exists: true }};
  var filter = {}; 
  
  return Presences.find(filter, { fields: { state: true, userId: true }});
});

And of course, don't forget to subscribe.

Meteor.subscribe('userPresence');

State function

If you want to track more than just users' online state, you can set a custom state function. (The default state function returns just 'online'):

// Setup the state function on the client
Presence.state = function() {
  return {
    currentRoomId: Session.get('currentRoomId')
  };
}

Now we can simply query the collection to find all other users that share the same currentRoomId

Presences.find({ state: { currentRoomId: Session.get('currentRoomId') }});

Of course Presence will call your function reactively, so everyone will know as soon as things change.

Contributing

Please! The biggest thing right now is figuring how to write tests.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].