mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 12:36:02 +01:00
update to socket.io 1.2.1, return_buffers option
This commit is contained in:
@@ -54,8 +54,8 @@
|
||||
"semver": "^4.0.3",
|
||||
"serve-favicon": "^2.1.5",
|
||||
"sitemap": "^0.7.4",
|
||||
"socket.io": "^1.2.0",
|
||||
"socket.io-client": "^1.2.0",
|
||||
"socket.io": "^1.2.1",
|
||||
"socket.io-client": "^1.2.1",
|
||||
"socket.io-redis": "^0.1.3",
|
||||
"socketio-wildcard": "~0.1.1",
|
||||
"string": "^2.1.0",
|
||||
|
||||
@@ -74,20 +74,22 @@
|
||||
}
|
||||
};
|
||||
|
||||
module.connect = function() {
|
||||
module.connect = function(options) {
|
||||
var redis_socket_or_host = nconf.get('redis:host'),
|
||||
cxn, dbIdx;
|
||||
|
||||
options = options || {};
|
||||
|
||||
if (!redis) {
|
||||
redis = require('redis');
|
||||
}
|
||||
|
||||
if (redis_socket_or_host && redis_socket_or_host.indexOf('/') >= 0) {
|
||||
/* If redis.host contains a path name character, use the unix dom sock connection. ie, /tmp/redis.sock */
|
||||
cxn = redis.createClient(nconf.get('redis:host'));
|
||||
cxn = redis.createClient(nconf.get('redis:host'), options);
|
||||
} else {
|
||||
/* Else, connect over tcp/ip */
|
||||
cxn = redis.createClient(nconf.get('redis:port'), nconf.get('redis:host'));
|
||||
cxn = redis.createClient(nconf.get('redis:port'), nconf.get('redis:host'), options);
|
||||
}
|
||||
|
||||
cxn.on('error', function (err) {
|
||||
|
||||
@@ -233,8 +233,8 @@ function addRedisAdapter(io) {
|
||||
if (nconf.get('redis')) {
|
||||
var redisAdapter = require('socket.io-redis');
|
||||
var redis = require('../database/redis');
|
||||
var pub = redis.connect();
|
||||
var sub = redis.connect();
|
||||
var pub = redis.connect({return_buffers: true});
|
||||
var sub = redis.connect({return_buffers: true});
|
||||
|
||||
io.adapter(redisAdapter({pubClient: pub, subClient: sub}));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user