【问题标题】:Regarding PubNub Channel groups关于 PubNub 频道组
【发布时间】:2014-12-10 01:36:33
【问题描述】:

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

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

【问题讨论】:

    标签: pubnub


    【解决方案1】:

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

    在 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 */
    

    }

    杰瑞米

    【讨论】:

    • 当消息通过consumersGroup通道来时,consumer怎么知道它来自哪个producer channel?还是消费者不了解特定渠道的设计重点?
    • 你在哪个客户端?
    • 每个帐户可以创建的渠道组数量是否有限制?
    • 没有限制,但如果您计划进行大型实施,请通过 support@pubnub.com 与我们联系——在大型实施的早期阶段与您合作有其优势 :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多