I am trying to emit logout event to erase client session and disconnect him. But I can not find proper solution online to do it. here is my code with comments:
exports.post = function(req, resp, next) {
var sid = req.session.id;
var io = req.app.settings.io;//import io object with event listeners
req.session.destroy(function(err) {
io.sockets.$emit('session:reload');//here I am trying to emit internal event but it does not work - says that it is not a function
if(err) return next(err);
resp.redirect('/');
});
}
Please help. In documentation there is nothing about this part.
via ovod
No comments:
Post a Comment