MCPcopy
hub / github.com/socketio/socket.io / SUBSCRIBE

Function SUBSCRIBE

packages/socket.io-cluster-engine/lib/redis.ts:179–192  ·  view source on GitHub ↗
(
  redisClient: any,
  channels: string[],
  listener: (message: Buffer) => void,
)

Source from the content-addressed store, hash-verified

177const RETURN_BUFFERS = true;
178
179function SUBSCRIBE(
180 redisClient: any,
181 channels: string[],
182 listener: (message: Buffer) => void,
183) {
184 if (isRedisClient(redisClient)) {
185 redisClient.subscribe(channels, listener, RETURN_BUFFERS);
186 } else {
187 redisClient.subscribe(channels);
188 redisClient.on("messageBuffer", (_channel: Buffer, message: Buffer) =>
189 listener(message),
190 );
191 }
192}
193
194/**
195 * Whether the redis client comes from the 'redis' or the 'ioredis' package

Callers 2

setupPrimaryWithRedisFunction · 0.85
constructorMethod · 0.85

Calls 2

isRedisClientFunction · 0.85
onMethod · 0.45

Tested by

no test coverage detected