Browse Source

redis

master
zeus 4 years ago
parent
commit
1433aa7810
  1. 7
      swarmlab-app/src/run/app.js

7
swarmlab-app/src/run/app.js

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

Loading…
Cancel
Save