New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@socket.io/redis-adapter

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@socket.io/redis-adapter - npm Package Compare versions

Comparing version 8.0.1 to 8.1.0

3

dist/index.d.ts

@@ -55,4 +55,6 @@ import { Adapter, BroadcastOptions, Room } from "socket.io-adapter";

private readonly responseChannel;
private readonly specificResponseChannel;
private requests;
private ackRequests;
private redisListeners;
/**

@@ -124,3 +126,4 @@ * Adapter constructor.

serverCount(): Promise<number>;
close(): Promise<void> | void;
}
export {};

@@ -69,2 +69,3 @@ "use strict";

this.ackRequests = new Map();
this.redisListeners = new Map();
this.uid = uid2(6);

@@ -78,21 +79,29 @@ this.requestsTimeout = opts.requestsTimeout || 5000;

this.responseChannel = prefix + "-response#" + this.nsp.name + "#";
const specificResponseChannel = this.responseChannel + this.uid + "#";
this.specificResponseChannel = this.responseChannel + this.uid + "#";
const isRedisV4 = typeof this.pubClient.pSubscribe === "function";
if (isRedisV4) {
this.subClient.pSubscribe(this.channel + "*", (msg, channel) => {
this.redisListeners.set("psub", (msg, channel) => {
this.onmessage(null, channel, msg);
}, true);
this.subClient.subscribe([this.requestChannel, this.responseChannel, specificResponseChannel], (msg, channel) => {
});
this.redisListeners.set("sub", (msg, channel) => {
this.onrequest(channel, msg);
}, true);
});
this.subClient.pSubscribe(this.channel + "*", this.redisListeners.get("psub"), true);
this.subClient.subscribe([
this.requestChannel,
this.responseChannel,
this.specificResponseChannel,
], this.redisListeners.get("sub"), true);
}
else {
this.redisListeners.set("pmessageBuffer", this.onmessage.bind(this));
this.redisListeners.set("messageBuffer", this.onrequest.bind(this));
this.subClient.psubscribe(this.channel + "*");
this.subClient.on("pmessageBuffer", this.onmessage.bind(this));
this.subClient.on("pmessageBuffer", this.redisListeners.get("pmessageBuffer"));
this.subClient.subscribe([
this.requestChannel,
this.responseChannel,
specificResponseChannel,
this.specificResponseChannel,
]);
this.subClient.on("messageBuffer", this.onrequest.bind(this));
this.subClient.on("messageBuffer", this.redisListeners.get("messageBuffer"));
}

@@ -706,3 +715,24 @@ const registerFriendlyErrorHandler = (redisClient) => {

}
close() {
const isRedisV4 = typeof this.pubClient.pSubscribe === "function";
if (isRedisV4) {
this.subClient.pUnsubscribe(this.channel + "*", this.redisListeners.get("psub"), true);
// There is a bug in redis v4 when unsubscribing multiple channels at once, so we'll unsub one at a time.
// See https://github.com/redis/node-redis/issues/2052
this.subClient.unsubscribe(this.requestChannel, this.redisListeners.get("sub"), true);
this.subClient.unsubscribe(this.responseChannel, this.redisListeners.get("sub"), true);
this.subClient.unsubscribe(this.specificResponseChannel, this.redisListeners.get("sub"), true);
}
else {
this.subClient.punsubscribe(this.channel + "*");
this.subClient.off("pmessageBuffer", this.redisListeners.get("pmessageBuffer"));
this.subClient.unsubscribe([
this.requestChannel,
this.responseChannel,
this.specificResponseChannel,
]);
this.subClient.off("messageBuffer", this.redisListeners.get("messageBuffer"));
}
}
}
exports.RedisAdapter = RedisAdapter;

6

package.json
{
"name": "@socket.io/redis-adapter",
"version": "8.0.1",
"version": "8.1.0",
"description": "The Socket.IO Redis adapter, allowing to broadcast events between several Socket.IO servers",

@@ -28,5 +28,7 @@ "license": "MIT",

"notepack.io": "~3.0.1",
"socket.io-adapter": "~2.4.0",
"uid2": "1.0.0"
},
"peerDependencies": {
"socket.io-adapter": "^2.4.0"
},
"devDependencies": {

@@ -33,0 +35,0 @@ "@types/expect.js": "^0.3.29",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc