无法将自定义消息发布到Openfire

问题描述

我想将以下消息发布到节点:

$('#send').click(function () {

            var ms = $iq({ type: 'set',to: 'pubsub.xyz.com',from: fromJid})
            .c('pubsub',{ xmlns: 'http://jabber.org/protocol/pubsub' })
            .c('publish',{node: "testNode"})
            .c('item')
            .c('x',{xmlns:  "jabber:x:data",type: "result"})
            .c('field',{"var": "color"})
            .c('value').t('red');      

    connection.sendIQ(
            ms,function(e) {
                console.log("Publis success");
            },function(e) {
                console.log("Publis err::" +e);
            });        
});    

它能够发布消息,但为空item

<message xmlns="jabber:client" from="pubsub.opbl-5cg933380j.internal.operative.com" to="hello@opbl-5cg933380j.internal.operative.com" id="jMdVQ6Dc"><event xmlns="http://jabber.org/protocol/pubsub#event"><items node="testNode"><item id="0682c2b8-8020-4fce-b0c7-9b726700192f40"/></items></event><headers xmlns="http://jabber.org/protocol/shim"><header name="SubID">P9b5tl1gtUB03gr4cBdAJq7o7BF9yVnwBgrYVlYa</header></headers></message>

解决方法

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

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

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