user3134962 user3134962 - 2 months ago 11
Javascript Question

Logic on disconnect sails.js

I am using sails.js with the raw API of Now when a user disconnects, I want to inform everyone else. Normally I would do something like:

socket.on('disconnect', function () {
//disconnect logic

But I am not sure how I would accomplish this inside of a sails.js controller. Any help would be appreciated.


Starting with Sails v0.9.8, your config/sockets.js file will have both onConnect and onDisconnect methods that give you access both to the connecting/disconnecting socket and the session.