socket.io redis ECONNREFUSED -


my host has allowed ports 8000 8010

var express = require('express')   , https = require('https')   , app = express()   , cluster = require('cluster')   , numcpus = require('os').cpus().length   , redisstore = require("socket.io/lib/stores/redis")   , redis = require("socket.io/node_modules/redis");   , pub = redis.createclient(8002)   , sub = redis.createclient(8002)   , client = redis.createclient(8002);   , server = https.createserver(options,app);   , io = require('socket.io').listen(server); io.set('store',new redisstore({redispub:pub,redissub:sub,redisclient:client})); if(cluster.ismaster){for(var i=0;i<numcpus;i++){cluster.fork();}} else{   console.log(numcpus);   io.sockets.on('connection',function(socket){/*do stuff*/});   server.listen(8002); } 

i'm having real trouble understanding if can't connect redis because of port or wether redis supplied socket.io turned on...

events.js:72     throw er; // unhandled 'error' event           ^ error: redis connection 127.0.0.1:8002 failed - connect econnrefused @ redisclient.on_error (/home/engine/public_html/node_modules/socket.io/node_modules/redis/index.js:149:24) @ socket.<anonymous> (/home/engine/public_html/node_modules/socket.io/node_modules/redis/index.js:83:14) @ socket.eventemitter.emit (events.js:95:17) @ net.js:426:14 @ process._tickcallback (node.js:415:13) [root@vps ~]#    info  - socket.io started 

also, don't understand how can give me workers (i console.log(numcpus) , says 1, mean have 1 worker? if so, means there no change performance; making endeavour pointless!?).

you'll need install , run own instance of redis , use node client connect.

see thread more information trying do.

examples in using redisstore in socket.io


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -