I want to perform some actions when the session is destroying. I am using the connect module from senchalabs and express module for my application.
The session#destroy
method does not emit any events that you can listen for in other parts of your app, but if you want to run some code immediately after the session is destroyed you can include it in the callback.
// Example variable
var numOfUsersOnline = 100
req.session.destroy(function(err){
// This get's run right after the session gets destroyed.
// You can put any code you want run in here, for example
// Descrease the number of users online
numOfUsersOnline--;
});