Skip to content

Instantly share code, notes, and snippets.

@tsega
Last active August 29, 2015 14:14
Show Gist options
  • Save tsega/a4b2f47f20bfa1b57daf to your computer and use it in GitHub Desktop.
Save tsega/a4b2f47f20bfa1b57daf to your computer and use it in GitHub Desktop.
How to add connection id to onClose callback (on the Server side)?
Meteor.onConnection(function(connection){
connection.onClose(function(){
Posts.update({"viewers.sessionId": this.id}, {
$pull: {
viewers: {
sessionId: this.id
}
}
});
});
});
@tsega
Copy link
Author

tsega commented Jan 23, 2015

Obviously this.id is not right! The connection object there has the id I want to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment