https://blog.csdn.net/xiao__gui/article/details/42642573 参考部分 Strophe.js使用
https://blog.csdn.net/love254443233/article/details/7751785 参考部分 xxml消息订阅
mian.js文件中 引入,注册成全局变量 ,此后调用 this.STROPHE.(方法名)
import strophe from './strophe/stropheUA'
Vue.prototype.STROPHE = strophe
stropheUA.js
// XMPP服务器BOSH地址
var BOSH_SERVICE = 'http://x.x.x.x:7070/http-bind';
// XMPP连接
var connection = null;
// 当前状态是否连接
var connected = false;
// 存放添加好友请求
var addFriend_warn = []
// 登陆
function login(username, password) {
if (!connected) {
connection = new Strophe.Connection(BOSH_SERVICE);
connection.connect(username + '@openfire.cn', password, onConnect);
}
}
// 接收到<message>
function onMess