I am using sails.js with the raw API of socket.io. 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With