AngularJS XMPP Get Roster -


i use xmpp jsjac library , angularjs programming chat application. can connect server, not list roster.

app.js

var app = angular.module("app", ["ngroute"]).config(["$routeprovider", function($routeprovider) {     $routeprovider         .when("/login", {             templateurl: "view/login.html",             controller: "logincontroller"         })         .when("/main", {             templateurl: "view/main.html",             controller: "maincontroller"         })         .otherwise({             redirectto: "/login"         }); }]); 

xmppservice.js

app.service("xmppservice", function() {     return {         conparams: null,         auth: function (userid, password) {             this.conparams = {                 httpbase: connectionconfig.httpbase,                 timerval: connectionconfig.timerval             };             con = new jsjachttpbindingconnection(this.conparams);             con.registerhandler('onconnect', this.onconnect);             con.registerhandler('onerror', this.onconnectfail);             this.conparams =  {                 username: userid,                 pass: password,                 domain: connectionconfig.serverdomain,                 resource: connectionconfig.resource,                 register: false             };             con.connect(this.conparams); // this.onroster function         },         onconnect: function() {             alert("connected");             //window.location = "#/main";             con.send(getrosteriqpacket(), this.onroster); // onroster undefined after connected         },         onconnectfail: function(error) {             alert("error");             console.log(error);         },         onroster: function(iq) {             alert("roster");             console.log(iq);         }     } }); 

if function except if service comes roster list.

add code in xmppservice

con.registerhandler('presence',     this.onpresence); con.registerhandler('iq',           this.handleiqset); con.registerhandler('message',      this.handlemessage); con.registerhandler('message',      this.handlemessageerror); con.registerhandler('ondisconnect', this.handledisconnect); con.registerhandler('onerror',      this.handleconerror); 

problem solved


Comments

Popular posts from this blog

java - Could not locate OpenAL library -

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

sorting - opencl Bitonic sort with 64 bits keys -