温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/reference/bun/RedisClient/subscribe
点击访问原文链接

RedisClient.subscribe method | Bun module | Bun

RedisClient.subscribe method | Bun module | BunBuildDocsReferenceGuidesBlogDiscord/Bun/RedisClient/subscribeMsubscribe

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/Bun/RedisClient/subscribeMsubscribe

method

RedisClient.subscribesubscribe(channel: string,listener: StringPubSubListener): Promisenumber>;

Subscribe to a Redis channel.

Subscribing disables automatic pipelining, so all commands will be received immediately.

Subscribing moves the channel to a dedicated subscription state which prevents most other commands from being executed until unsubscribed. Only .ping(), .subscribe(), and .unsubscribe() are legal to invoke in a subscribed upon channel.

@param channel

The channel to subscribe to.

@param listener

The listener to call when a message is received on the channel. The listener will receive the message as the first argument and the channel as the second argument.

await client.subscribe("my-channel", (message, channel) => {
console.log(`Received message on ${channel}: ${message}`);
});
subscribe(channels: string[],listener: StringPubSubListener): Promisenumber>;

Subscribe to multiple Redis channels.

Subscribing disables automatic pipelining, so all commands will be received immediately.

Subscribing moves the channels to a dedicated subscription state in which only a limited set of commands can be executed.

@param channels

An array of channels to subscribe to.

@param listener

The listener to call when a message is received on any of the subscribed channels. The listener will receive the message as the first argument and the channel as the second argument.

Referenced typestype StringPubSubListener = (message: string, channel: string) => void

Resources

ReferenceDocsGuidesDiscordMerch StoreGitHubBlog 

Toolkit

RuntimePackage managerTest runnerBundlerPackage runner

Project

Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicense

Baked with ❤️ in San Francisco

We're hiring →

RedisClient.subscribe method | Bun module | Bun,AI智能索引,全网链接索引,智能导航,网页索引

    API documentation for method bun.RedisClient.subscribe | Bun