balderdashy/sails — pull request #1842 by danjenkins (2014-06-12 10:34:02+00:00)
Title: Socketio redis error

New PR against the right branch

Branched from the latest 0.9 tag which is 0.9.16

When using the redis adapter for Socket.io, there was no way to pass in a listener for on Error, which meant that the application just dies when you get an error back from Redis - such as losing connection. Yes, dying is probably the best bet bet its better to handle that gracefully rather than having a nasty process.on('uncaughtException') dealing with all errors, I'd rather deal with a redis error in my codebase.

This allows you to listen in on the ready event and the error event from Redis. The raw connection is also passed back to the error callback, so that you can get down and dirty with the connection itself if you need to, such as knowing when you've reconnected.