在strophe.js中创建一个收集节点

问题描述

我想用Strophe.js创建一个收集节点。有一个createNode函数和您可以提供的选项。但是我不确定这些选项应该是json对象还是xml。你能举个例子吗?这是功能

/***Function

Create a pubsub node on the given service with the given node
name.

Parameters:
(String) node -  The name of the pubsub node.
(Dictionary) options -  The configuration options for the  node.
(Function) call_back - Used to determine if node
creation was sucessful.

Returns:
Iq id used to send subscription.
*/
createNode: function(node,options,call_back) {
    var that = this._connection;

    var iqid = that.getUniqueId("pubsubcreatenode");

    var iq = strophe_js.$iq({from:this.jid,to:this.service,type:'set',id:iqid})
      .c('pubsub',{xmlns:strophe_js.Strophe.NS.PUBSUB})
      .c('create',{node:node});
    if(options) {
        iq.up().c('configure').form(strophe_js.Strophe.NS.PUBSUB_NODE_CONfig,options);
    }

    that.addHandler(call_back,null,'iq',iqid,null);
    that.send(iq.tree());
    return iqid;
},

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)