如何使用Strophe.js启用流管理?

时间:2019-01-09 12:07:01

标签: javascript xmpp openfire strophe strophe.js

根据https://github.com/strophe/strophejs-plugin-stream-management的准则,我加入了以下声明以启用流管理:

var url = BOSH_SERVICE;
connection = new Strophe.Connection(url);

connection.rawInput = rawInput;
connection.rawOutput = rawOutput;

var button = $('#connect').get(0);
if (button.value == 'connect' && $('#jid').val() != '' && $('#pass').val() != '') {
    connection.streamManagement.enable();
    connection.streamManagement.sendCountOnEveryIncomingStanza = true;
  var jid_val = $('#jid').val().toLowerCase().replace(/ /g, '');

  connection.connect(jid_val + '@' + server + `/${navigator.userAgent.split(' ')[2].split(';')[0]}`, $('#pass').get(0).value, onConnect);

}
}

服务器应返回“启用”或“失败”,但这是我得到的:https://i.imgur.com/Aa6yi4B.png

有什么建议吗?

0 个答案:

没有答案