Hi, I spent the last two weeks trying to figurate how integrate quickblox in my project. And furthest I made was only create a session.
When I try to do the
quickblox.chat.connect
I get this strange error
Runtime Error
this is undefined
And all the google searchs I made, didn’t helped me to solve this problem.
So for simplicity I started a blank project and was debugging with the console, this is my code:
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
// import * as $ from "jquery";
import * as quickblox from "quickblox";
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
CREDENTIALS:any = {
appId: 54485,
authKey: 'WV9zLPSGEOSDh7j',
authSecret: 'GeBPsdBrQLrPjKZ'
};
user:any = {
id: 24786158,
login: 'test',
pass: 'qwerty1234'
};
constructor(public navCtrl: NavController) {
quickblox.init(this.CREDENTIALS.appId, this.CREDENTIALS.authKey, this.CREDENTIALS.authSecret);
quickblox.createSession(
{login: this.user.login, password: this.user.pass},
function(err, result) {
if (result){
quickblox.chat.connect(
{userId: this.user.id, password: this.user.pass},
function(err, roster){
if (err){
console.log(err);
}
});
}
console.log(err);
console.log(result);
});
}
}
I know
quickblox.createSession
works fine, because I get the success response from server.
Any help or guide will be very helpful for me, I’m new in this field, and this error it’s driven me crazy.
Thanks in advance.
import * as quickblox from “quickblox”;
quickblox.init(this._utilityService.QBApp.appId, this._utilityService.QBApp.authKey, this._utilityService.QBApp.authSecret, this._utilityService.QBApp.CONFIG);
error_handler.js:60 ReferenceError: Strophe is not defined