Joined February 2014
·

Mike McNeil

sailsjs
·
Austin, TX
·
·
·

You can also use the HTTP session store you're already using if you've got it backed up to a database like redis.

e.g. in sails:

onDisconnect: function (session, socket){
  User.findOne(session.me).exec(function (err, user){
    if (err) {
      sails.log.error('Error occurred in onDisconnect handler: ', err);
      return;
    }
    if (!user) {
      sails.log.warn('User attached to the disconnecting socket no longer exists.');
      return;
    }

    // ...
    // --make call to 3rd party service here--
    // ...
  })
}

nice :)

Achievements
29 Karma
0 Total ProTip Views
Interests & Skills