1

Below is how i initialize and emit but i dont find any errors nor do my server listening, receives any events.

const io = require('socket.io-emitter')({
  host: 127.0.0.1,
  // path: do i need this ?
  port: redisUri.port,
  pub: pub, // is the key required to be the same as the app ?
  sub: sub, // is the key required to be the same as the app ?
});

io.emit('test', 'test'})

i tried many variations, can someone enlighten me how can i debug this ?

ive tried to add a redis href before the object as well.

DarkArtistry
  • 434
  • 1
  • 6
  • 22

1 Answers1

0

I found the error, the issue was with the pub and sub sockets.

Here's the solution:

var pub = redisPassword ? redis.createClient(6379, localhost, {return_buffers: true, auth_pass: redisPassword}) : undefined;
var sub = redisPassword ? redis.createClient(6379, localhost, {detect_buffers: true, return_buffers: true, auth_pass: redisPassword}) : undefined;
socketio.adapter(require('socket.io-redis')({ host: localhost, port: 6379, pubClient: pub, subClient: sub }));

This was the issue:

Instead of having it at undefined for the checking of password, I created another client, it was easier to set it to default.

Please do let me know if I could improve my code. Thank you.

NightFury
  • 13,436
  • 6
  • 71
  • 120
DarkArtistry
  • 434
  • 1
  • 6
  • 22