"use strict" var pathmodule = require('path'); var app = require('express')(); var http = require('http').Server(app); var https = require('https'); var io = require('socket.io')(http); //import { createAdapter } from 'socket.io-redis'; const createAdapter = require('socket.io-redis'); //import { RedisClient } from 'redis'; const RedisClient = require("redis"); const pubClient = RedisClient.createClient({ host: 'redisserver', port: 6379, }); //const pubClient = new RedisClient({ host: 'localhost', port: 6379 }); const subClient = pubClient.duplicate(); io.adapter(createAdapter({ pubClient, subClient })); pubClient.on("connect", function() { console.log("You are now connected"); }); setInterval(function () { var resob1 = {} resob1.data = '1' resob1.user25user = 'user' var resob1string = JSON.stringify(resob1); console.log('-------------------- '+JSON.stringify(resob1string)); var resob1string = 'test'; pubClient.hmset('ekjgpiegwerpowfmfsdfsdgsk', resob1string, function(err, res) { console.log('>>>>>>>>>eroor>>>>>>>>>>>>>>>>>>> '+JSON.stringify(err)); console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> '+JSON.stringify(res)); }); pubClient.hgetall('ekjgpiegwerpowfmfsdfsdgsk', function(err, object) { console.log('<<<<<<<<< console.error('listening on http://localhost:3000/')); console.error('socket.io example');