【问题标题】:xmpp pubsub understandingxmpp pubsub 理解
【发布时间】:2009-10-16 13:32:04
【问题描述】:

订阅者只会在订阅节点时收到内容,并且订阅者不会收到发布者发布的所有旧内容。它是否正确?我可以知道,我需要做什么才能让订阅者接收所有以前的旧内容?

【问题讨论】:

    标签: xmpp openfire smack


    【解决方案1】:

    您可以将节点配置为持久性或临时性。根据specifictaion (XEP-0060)

    节点是持久的还是瞬态的,由“pubsub#persist_items”配置字段决定。

    但是,您的 pubsub 服务(或服务器)可能被配置为忽略事件的持久性。 (如果您使用的是 Openfire,我认为存储项目的最大总大小有一个可配置的限制)

    据我所知,您使用的是smackx-pubsub,下面是一些代码:

    // create new node
    pubSubManager.createNode(nodeId, newConfigureForm(persistent, includePayload, accessModel)
    
    // change existing node
    node.sendConfigurationForm(newConfigureForm(persistent, includePayload, accessModel));
    
    private ConfigureForm newConfigureForm(final boolean persistent, final boolean includePayload, final AccessModel accessModel) {
      final ConfigureForm form = new ConfigureForm(FormType.submit);
      form.setPersistentItems(persistent);
      form.setDeliverPayloads(includePayload);
      form.setAccessModel(accessModel);
      return form;
    }
    

    PS:你能告诉我为什么我觉得我们在这里做的是结对编程吗? ;)

    【讨论】:

    • @cometta 和 @sfussenegger - 你忽略了要获取旧项目,你必须执行 node.getItems()。此外,您应该从其源代码 (igniterealtime.org/downloads/source.jsp) 构建 Smack 而不是 github 版本,以获取 pubsub 代码的最新版本。
    • @Robin 所以 pubsub 终于开箱即用了吗?从 3.2 版开始?
    猜你喜欢
    • 2016-04-04
    • 1970-01-01
    • 1970-01-01
    • 2012-02-04
    • 2018-08-23
    • 2012-08-19
    • 1970-01-01
    • 2018-03-10
    • 2012-08-14
    相关资源
    最近更新 更多