The Redis client automatically connects. Just make sure you handle the event "error"from the client. By example :
var redis = require('redis');
client = redis.createClient();
client.on('error', function(err){
console.error('Redis error:', err);
});
Otherwise, this code is the beginning of the process.
this.emit("error", new Error(message));
this.connection_gone("error");
Further on the client is executed . connection_gone () .
Please note that you can also listen to an event "reconnecting"that will be notified when this happens.
source
share