1

I have a Redis client like so:

var redis = require("redis");
var client = redis.createClient();
client.config("SET","notify-keyspace-events", "KEA");

with the 3rd line of code, it is now configured to listen to sets and deletes of Redis keys. So this client acts as a subscriber. However, the problem is that I want this Redis client to also be able to re-publish information it receives from Redis itself, and the same Redis client can't act as both subscriber and publisher. So it seems I have two choices:

  1. use a second Redis client in the same file, to act as a publisher
  2. use Socket.io with only one Redis client instead of two

Is this correct? Which one is better in this case?

Alexander Mills
  • 90,741
  • 139
  • 482
  • 817

1 Answers1

2

No need of Socket.IO there. Just use a second Redis client. An extra Redis connection is cheap.

Didier Spezia
  • 70,911
  • 12
  • 189
  • 154