mercredi 28 juin 2017

Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED In laravel

when I run node serve.js, getting following error

   throw er; // Unhandled 'error' event
   ^

 Error: Redis connection to 127.0.0.1:6379 failed - connect ENFILE 127.0.0.1:6379 - Local (undefined:undefined)
at Object.exports._errnoException (util.js:1018:11)
at exports._exceptionWithHostPort (util.js:1041:20)
at connect (net.js:880:16)
at net.js:969:9
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickCallback (internal/process/next_tick.js:104:9)

Server.js file

  var app = require('express')();
  var server = require('http').Server(app);
  var io = require('socket.io')(server);
  var redis = require('redis');

  server.listen(8890);
  io.on('connection', function (socket) {

   console.log("client connected");
   var redisClient = redis.createClient();
   redisClient.subscribe('message');

   redisClient.on("message", function(channel, data) {
   console.log("mew message add in queue "+ data['message'] + " channel");
   socket.emit(channel, data);
 });

  socket.on('disconnect', function() {
  redisClient.quit();
 });

 });

How can I fix above error.I have install node,npm,predis and socet.io



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire