LearnBoost/socket.io — Issue #681: RedisStore Auth
Author: laoshanlung
Created: 2011-12-11 11:48:11+00:00
State: open

I am using SocketIO 0.8.7. I want to use RedisStore to scale my socketIO application across multiple processes using cluster.

This is the code for creating the RedisStore object

````javascript
new RedisStore({
redisPub: redisConnection.createClient(),
redisSub: redisConnection.createClient(),
redisClient: redisConnection.createClient()
})
`````
The redisConnection is a custom code that I wrote to create the RedisClient based on the configuration specified in main config file. The redisConnection is working fine, I have checked it and find no error.

This is the code for redisConnection

````javascript
var mainConfig = require("./configs/mainConfig.js");

var redis = require("redis");
var password = mainConfig.db.password || '';

exports.redis = redis;
exports.createClient = function() {

var c = redis.createClient(mainConfig.db.port, mainConfig.db.host);
if(password.length > 0) {
c.auth(mainConfig.db.password);
}
return c;
}
`````

The error shown when running the above code

```javascript
Error: Uncaught, unspecified 'error' event.
at RedisClient.emit (events.js:47:15)
at Command.callback (/usr/local/lib/node_modules/socket.io/node_modules/redis/index.js:232:29)
at RedisClient.return_error (/usr/local/lib/node_modules/socket.io/node_modules/redis/index.js:382:25)
at RedisReplyParser. (/usr/local/lib/node_modules/socket.io/node_modules/redis/index.js:78:14)
at RedisReplyParser.emit (events.js:64:17)
at RedisReplyParser.send_error (/usr/local/lib/node_modules/socket.io/node_modules/redis/lib/parser/javascript.js:265:14)
at RedisReplyParser.execute (/usr/local/lib/node_modules/socket.io/node_modules/redis/lib/parser/javascript.js:124:22)
at RedisClient.on_data (/usr/local/lib/node_modules/socket.io/node_modules/redis/index.js:358:27)
at Socket. (/usr/local/lib/node_modules/socket.io/node_modules/redis/index.js:93:14)
at Socket.emit (events.js:64:17)
```