I'm asking myself : "How could I trigger an IO event to a specific user (like notification when sucess on something)". But on a post request for example I don't have any socket objet.
I want to be able to do this: (should I store the socket object in a cookie? Or there are other possibilities availible?)
app.post('/askChangeUserPass', ChangePassIfCorrect , function (req, res){
if (req.session) {
if ( req.data == 1 ){
return res.send("1") // socket.emit("notification", {})
} else {
return res.send("req.data") // socket.emit("notification", {})
}
} else {
return res.render("404")
}
});