Files
fangche/utils/im.js
2021-04-07 14:32:34 +08:00

33 lines
838 B
JavaScript

import GoEasy from './goeasy-1.2.1';
class ImSdk {
im = {}
constructor(appkey){
im = GoEasy.getInstance({
host: "hangzhou.goeasy.io", //应用所在的区域地址: 【hangzhou.goeasy.io |singapore.goeasy.io】
appkey
})
}
connect(){
this.im.connect({
onSuccess: function () { //连接成功
console.log("GoEasy connect successfully.") //连接成功
},
onFailed: function (error) { //连接失败
console.log("Failed to connect GoEasy, code:"+error.code+ ",error:"+error.content);
},
onProgress:function(attempts) { //连接或自动重连中
console.log("GoEasy is connecting", attempts);
}
})
}
}
export default ImSdk