Change our presence package

tmeasday:presence was doing unnecessary ping calls to the server every
5 seconds instead of using the status of the DDP connection (this
could save a fair amount of traffic in case of important server load).

I guess this change also fixes #221, but since no issue reproduction
was provided, it's difficult to tell.
This commit is contained in:
Maxime Quandalle 2015-09-04 01:40:29 +02:00
parent 40fafd4b14
commit 521e661dcb
7 changed files with 12 additions and 12 deletions

View file

@ -113,7 +113,7 @@ globals:
Mousetrap: false
Picker: false
Presence: true
Presences: true
presences: true
Ps: true
ReactiveTabs: false
SimpleSchema: false

View file

@ -44,6 +44,7 @@ reactive-dict
session
tracker
underscore
3stack:presence
alethes:pages
arillo:flow-router-helpers
audit-argument-checks
@ -56,7 +57,6 @@ mquandalle:moment
ongoworks:speakingurl
raix:handlebar-helpers
tap:i18n
tmeasday:presence
# UI components
blaze

View file

@ -1,3 +1,4 @@
3stack:presence@1.0.3
accounts-base@1.2.1-rc.2
accounts-password@1.1.2-rc.1
aldeed:collection2@2.3.3
@ -126,7 +127,6 @@ tap:i18n@1.5.1
templates:tabs@2.2.0
templating@1.1.2-rc.4
templating-tools@1.0.0-rc.0
tmeasday:presence@1.0.6
tracker@1.0.8-rc.0
ui@1.0.7-rc.0
underscore@1.0.4-rc.0

View file

@ -16,7 +16,7 @@ Template.userAvatar.helpers({
},
presenceStatusClassName() {
const userPresence = Presences.findOne({ userId: this.userId });
const userPresence = presences.findOne({ userId: this.userId });
if (!userPresence)
return 'disconnected';
else if (Session.equals('currentBoard', userPresence.state.currentBoardId))

View file

@ -0,0 +1,7 @@
Presence.configure({
state() {
return {
currentBoardId: Session.get('currentBoard'),
};
},
});

View file

@ -145,10 +145,3 @@ if (Meteor.isServer) {
});
});
}
// Presence indicator
if (Meteor.isClient) {
Presence.state = () => {
return { currentBoardId: Session.get('currentBoard') };
};
}

View file

@ -141,7 +141,7 @@ Meteor.publishComposite('board', function(boardId) {
// Presence indicators
children: [{
find(user) {
return Presences.find({userId: user._id});
return presences.find({userId: user._id});
},
}],
},