Last active
August 29, 2015 14:14
-
-
Save tsega/a4b2f47f20bfa1b57daf to your computer and use it in GitHub Desktop.
How to add connection id to onClose callback (on the Server side)?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Meteor.onConnection(function(connection){ | |
connection.onClose(function(){ | |
Posts.update({"viewers.sessionId": this.id}, { | |
$pull: { | |
viewers: { | |
sessionId: this.id | |
} | |
} | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Obviously
this.id
is not right! Theconnection
object there has theid
I want to use.