如何解决在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 举报,一经查实,本站将立刻删除。