Callbacks?
Closed this issue · 7 comments
madshargreave commented
Is there a callback I can call when a user goes online/offline?
In my case, I want to set up an eventlistener when a user gets online, and detach it again when they go offline
rodrigok commented
There isn't the callback you want.
Do you need this at server or client side?
stefankutko commented
Great package, using with multiple instances... I would also find this helpful server side.
rodrigok commented
@stefankutko can you show me your use case for callbacks at server side?
madshargreave commented
I want to attach an event listener to a user once online, and detach it upon going offline
Something like:
UserStatus.onConnect(function(user) {
SomeCollection.startTwitterStream(user);
});
UserStatus.onDisconnect(function(user) {
SomeCollection.stopTwitterStream(user);
});
rodrigok commented
@madshargreave at server side?
madshargreave commented
Yes server side
rodrigok commented
Ok, now you can: https://github.com/Konecty/meteor-user-presence/blob/master/server%2Fmonitor.js#L2
On new version (1.2.6) you can use:
UserPresenceMonitor.onSetUserStatus = function(user, status, statusConnection) {
// code
}