【发布时间】:2018-07-15 07:13:11
【问题描述】:
我已经用 fastpath 插件安装了 openfire。 使用反向插件,我可以将用户重定向到工作组中的适当队列。
现在,我正在尝试将 converse.js 添加到具有相同功能的页面中。我可以看到其他联系人并与之聊天,但是当 fastpath 试图让我与相应的代理(基于一个问题)进行会议时,我收到了一个错误。
这是我的js:
converse.initialize({
bosh_service_url: 'http://chat.domain.com:7070/http-bind/',
show_controlbox_by_default: true,
allow_muc_invitations: true,
keepalive: true,
debug: true,
allow_non_roster_messaging: true,
allow_contact_requests: true,
auto_join_on_invite: true,
roster_groups: true,
jid: 'user@chat.domain.com',
password: 'password',
auto_login: true,
auto_subscribe: true
});
开启:
_converse.onDirectMUCInvitation = function (message) {
var x_el = message.querySelector('x[xmlns="jabber:x:conference"]'),
from = Strophe.getBareJidFromJid(message.getAttribute('from')),
room_jid = x_el.getAttribute('jid'),
reason = x_el.getAttribute('reason');}
尽管消息包含以下内容,但 x_el 为空:
<message xmlns="jabber:client"
from="pjiw6d129@conference.chat.domain.com"
to="user@chat.domain.com/converse.js-60521038">
<workgroup xmlns="http://jabber.org/protocol/workgroup" jid="test@workgroup.chat.domain.com"/>
<session xmlns="http://jivesoftware.com/protocol/workgroup" id="pjiw6d129"/>
<x xmlns="http://jabber.org/protocol/muc#user">
<invite from="test@workgroup.chat.domain.com">
<reason>Please join me for a chat.</reason>
</invite>
</x>
<x xmlns="jabber:x:conference" jid="pjiw6d129@conference.chat.domain.com"/>
我遗漏了一些东西,但看不清楚。
感谢您的帮助!
问题出在querySelector,被替换了
room_jid = x_el.getAttribute('jid'),
reason = x_el.getAttribute('reason');}
与
room_jid = message.getElementsByTagName('x')[1].getAttribute('jid'),
reason = message.getElementsByTagName('x')[0].getAttribute('reason');
在 converse.js 中
【问题讨论】:
标签: javascript openfire strophe converse.js