Skip to content

7.1.0

Compare
Choose a tag to compare
@darrachequesne darrachequesne released this 30 Nov 00:19
· 5 commits to master since this release
e0850c8

Features

  • add support for redis v4 (aa681b3)
  • do not emit "error" events anymore (8e5c84f)

Error handling can now be done on the redis clients directly.

Before:

io.of("/").adapter.on("error", () => {
  // ...
});

After:

pubClient.on("error", () => {
  // something went wrong
});

subClient.on("error", () => {
  // something went wrong
});
  • send response to the requesting node only (f66de11)

A more performant way to do request-response is available behind an option, publishOnSpecificResponseChannel:

const io = require('socket.io')(3000);
const { createClient } = require('redis');
const redisAdapter = require('@socket.io/redis-adapter');

const pubClient = createClient({ host: 'localhost', port: 6379 });
const subClient = pubClient.duplicate();
io.adapter(redisAdapter(pubClient, subClient, {
  publishOnSpecificResponseChannel: true
}));

To upgrade an existing deployment, you will need to upgrade all nodes to the latest version with publishOnSpecificResponseChannel = false, and then toggle the option on each node.

Please check the commit for more information.

Links