I saw this snippet:
io.sockets.on(\'connection\', function(socket) {
const subscribe = redis.createClient();
const publish = redis.cr
Redis is used here for at least two reasons. The first one is that it works really well as a publish and subscribe mechanism, including being able to select messages based on pattern matching to psubscribe. The second reason is the ease of other clients to be able to publish and subscribe through the redis mechanism. That is not to say that it is impossible, just convenient. This combined with the asynchronisity of node.js makes a powerful partnership.
It's not the only solution of course but one that seems to work rather well.