根据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
有什么建议吗?