PubSub

SUBSCRIBE

Subscribe to a channel

Arguments

channelsbodystring | string[]required

The channel to publish to.

Response

Subscriberrequired

A subscriber instance which can subscribe to channels.

Example
const subscription = redis.subscribe(["my-channel"]);const messages = [];subscription.on("message", (data) => {  messages.push(data.message);});
Loading search…