I am currently developing a chat application using MongooseIm Xmpp server and strophe based client in an hybrid Ionic4/Angular 8 application.
I am able to connect via web and devapp but on installing the exported apk the client connection times out and i cannot connect to the xmpp server.
I get Connection timeout or connection fail.
below is how i make the connection: (the actual url in the mobile app is mongooseIm instance on aws)
this.xmppConnection = new Strophe.Connection('http://localhost.com:5280/http-bind');
this.xmppConnection.connect(
jid + '@' + this.host,
password,
this.onConnect
);
OnConnect Handler:
private onConnect(status: any): void {
switch (status) {
case Strophe.Status.CONNECTING:
alert('Connecting to xmpp...');
break;
case Strophe.Status.CONNFAIL:
alert('xmpp connection failed!');
break;
case Strophe.Status.DISCONNECTING:
alert('Disconnecting from xmpp...');
break;
case Strophe.Status.DISCONNECTED:
alert('Disconnected from xmpp');
break;
case Strophe.Status.CONNECTED:
alert('xmpp connected!');
break;
case Strophe.Status.AUTHENTICATING:
alert('xmpp authenticating...');
break;
case Strophe.Status.AUTHFAIL:
alert('xmpp authentication failed!');
break;
case Strophe.Status.ERROR:
alert('xmpp generic connection error!');
break;
case Strophe.Status.ATTACHED:
alert('xmpp connection attached!');
break;
case Strophe.Status.REDIRECT:
alert('xmpp connection redirected!');
break;
case Strophe.Status.CONNTIMEOUT:
alert('xmpp connection timeout!');
break;
default:
alert('xmpp: Unknow connection status');
}
}
Any help would be appreciated.