Ionic framework 爱奥尼亚4无法访问‘;客户&x2019;在Module.createclient初始化之前
我正在使用离子4,成功安装后,当我尝试测试连接时,它会向我抛出错误,如 在初始化Module.createClient之前,ionic 4无法访问“客户端”Ionic framework 爱奥尼亚4无法访问‘;客户&x2019;在Module.createclient初始化之前,ionic-framework,ionic4,stanza.io,stanza,Ionic Framework,Ionic4,Stanza.io,Stanza,我正在使用离子4,成功安装后,当我尝试测试连接时,它会向我抛出错误,如 在初始化Module.createClient之前,ionic 4无法访问“客户端” import * as XMPP from 'stanza'; export class StanzaTestPage implements OnInit { client: any; constructor() { } ngOnInit() { this.createConn(); } createCo
import * as XMPP from 'stanza';
export class StanzaTestPage implements OnInit {
client: any;
constructor() {
}
ngOnInit() {
this.createConn();
}
createConn() {
let that = this;
this.client = XMPP.createClient({
jid: 'testUser@testhost',
password: 'Pass_123',
transport: 'websocket',
wsURL: 'ws://***:1234/websock',
useStreamManagement: true
});
this.client.connect();
this.client.enableKeepAlive(/* { interval: 30 } */);
this.client.on('auth:failed', function (err) {
console.log("auth:failed.......");
console.log(err);
});
this.client.on('disconnected', function (err) {
console.log("disconnected.......");
console.log(err);
});
this.client.on('session:error', function (err) {
console.log("session:error.......");
console.log(err);
});
this.client.on('auth:success', function (con) {
console.log("auth:success.......");
console.log(con);
});
this.client.on('session:started', function () {
console.log("Session Started.......");
that.client.sendPresence();//sending our presense in server
});
}
}