balderdashy/sails — pull request #1724 by danjenkins (2014-05-20 13:33:07+00:00)
Title: Socketio redis error

Branched from the latest 0.9 tag which is 0.9.16

However, there isn't a branch available for me to align the PR against - so it's currently against Master, if you make me a branch I can realign the PR so the commits are against the right branch.

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.