2

I want to extract the socket associated with user session (MEAN js 0.4.0) , i'm not getting a way to achieve that. As an example , inside the create method i want to get an instance of socket associated with the current user session.

exports.create = function (req, res) {
    var article = new Article(req.body);
    article.user = req.user;
    article.save(function (err) {
        if (err) {
            return res.status(400).send({
                message: errorHandler.getErrorMessage(err)
            });
        } else {
            //get socket instance for this session , and send a message that  article is created
            res.json(article);
        }
    });
};
Fabian N.
  • 3,807
  • 2
  • 23
  • 46
surya singh
  • 277
  • 6
  • 23

0 Answers0