|
@ -10,7 +10,6 @@ var io = require('socket.io')(http); |
|
|
const createAdapter = require('socket.io-redis'); |
|
|
const createAdapter = require('socket.io-redis'); |
|
|
//import { RedisClient } from 'redis';
|
|
|
//import { RedisClient } from 'redis';
|
|
|
const RedisClient = require("redis"); |
|
|
const RedisClient = require("redis"); |
|
|
//const pubClient = redis.createClient({ host: 'localhost', port: 6379 } );
|
|
|
|
|
|
const pubClient = RedisClient.createClient(); |
|
|
const pubClient = RedisClient.createClient(); |
|
|
|
|
|
|
|
|
//const pubClient = new RedisClient({ host: 'localhost', port: 6379 });
|
|
|
//const pubClient = new RedisClient({ host: 'localhost', port: 6379 });
|
|
@ -18,7 +17,7 @@ const subClient = pubClient.duplicate(); |
|
|
|
|
|
|
|
|
io.adapter(createAdapter({ pubClient, subClient })); |
|
|
io.adapter(createAdapter({ pubClient, subClient })); |
|
|
|
|
|
|
|
|
RedisClient.on("connect", function() { |
|
|
pubClient.on("connect", function() { |
|
|
console.log("You are now connected"); |
|
|
console.log("You are now connected"); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
@ -436,8 +435,8 @@ function onCollection(err, collection) { |
|
|
resob1.res25fileforce = resdata.data[i].res25fileforce |
|
|
resob1.res25fileforce = resdata.data[i].res25fileforce |
|
|
resob1.tailed_path = pathfileval |
|
|
resob1.tailed_path = pathfileval |
|
|
//resobarray.push(resob1)
|
|
|
//resobarray.push(resob1)
|
|
|
RedisClient.hmset(pathfileval,JSON.stringify(resob1)) |
|
|
pubClient.hmset(pathfileval,JSON.stringify(resob1)) |
|
|
RedisClient.hgetall(pathfileval, function(err, object) { |
|
|
pubClient.hgetall(pathfileval, function(err, object) { |
|
|
console.log('redis '+object); |
|
|
console.log('redis '+object); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|