From f893e3d01317dfc8ca9bb9feb9ba7b2b86ccfe98 Mon Sep 17 00:00:00 2001 From: zeus Date: Sat, 28 Nov 2020 22:05:42 +0200 Subject: [PATCH] async --- swarmlab-app/src/run/app.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/swarmlab-app/src/run/app.js b/swarmlab-app/src/run/app.js index 7f68b7f..ed7334b 100755 --- a/swarmlab-app/src/run/app.js +++ b/swarmlab-app/src/run/app.js @@ -39,10 +39,11 @@ const pubtest = new Redis({ //import { createAdapter } from 'socket.io-redis'; const createAdapter = require('socket.io-redis'); -const RedisClient = require("redis"); -//const Redis = require("ioredis"); -const pubClient = RedisClient.createClient({ -//const pubClient = new Redis({ +//const RedisClient = require("redis"); +const Redis = require("ioredis"); +//const pubClient = RedisClient.createClient({ + +const pubClient = new Redis({ host: 'redisserver', port: 6379, }); @@ -519,16 +520,16 @@ function onCollection(err, collection) { var user = resob1.res25creator //io.in(user).emit("logdata", reslog); //var user = 'anagnostopoulos@uniwa.gr' - /* + pubClient.get(issend).then(function (result) { - console.log(result); // Prints "bar" + console.log("---result--- "+result); // Prints "bar" io.in(user).emit("logdata", reslog); }); - */ + pubClient.get(issend, function(err, object) { if(err == null){ pubClient.set(issend, itemsProcessed, function(err, res) { - io.in(user).emit("logdata", reslog); + //io.in(user).emit("logdata", reslog); }); } itemsProcessed++;