gpt4 book ai didi

pubnub - 关于 PubNub channel 组

转载 作者:行者123 更新时间:2023-12-02 03:31:04 24 4
gpt4 key购买 nike

想象一下我们有很多生产者和一个消费者的场景。消费者订阅了一个名为“consumerGroup”的 channel 组。生产者每次进入系统,都会将 channel “Producer-ID-Channel”添加到consumerGroup,订阅 channel 并发布消息。

消费者是否会自动订阅该 channel ,因为他已经订阅了该 channel 所属的群组?即使制作人的 channel 是在他最初订阅群组后添加到群组中的?

最佳答案

是的!客户端需要做的就是订阅 channel 组,当 channel 以任何方式添加/删除到 channel 组时,客户端都会收到它们。

在 JavaScript 上,如果您的消息回调如下所示:

function cb(message, envelope, channel){
/* message will contain the message
envelope will contain the server-response, in which data like message and channel are
derived from.

element 0 will be the current message in the callback cycle
(also accessible via 'message')
element 1 will be the timetoken of the server response
element 2 will be the channel group name the message arrived on
element 3 will be the actual channel within the channel group the msg arrived on */

杰瑞米

关于pubnub - 关于 PubNub channel 组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26715501/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com