10-26-2016 02:05 PM
I followed the sample code from the Non Gadget and I can get user notifications and dialog notification but no queues info.
This is the code I have, I put the sendIq function inside the successCallback
I just want to subscribe to realtime queue changes. Thank you
var _username = "1041";
var _domain = "SERVER.com";
var _password = "password";
function _eventConnect() {
if (window.jabberwerx) {
//alert("connecting");
//Construct JID with username and domain.
jid = _username + "@" + _domain,
//Create JabbwerWerx object.
_jwClient = new jabberwerx.Client("resource");
//Arguments to feed into the JabberWerx client on creation.
jwArgs = {
//Defines the BOSH path. Should match the path pattern in the proxy
//so that it knows where to forward the BOSH request to.
httpBindingURL: "https://SERVER.com:7443/http-bind/",
//Calls this function callback on successful BOSH connection by the
//JabberWerx library.
errorCallback: onClientError,
successCallback: function () {
//Get the server generated resource ID to be used for subscriptions.
_finesse.setResource(_jwClient.resourceName);
_jwClient.sendIq('set', "pubsub.SERVER.com", "<pubsub xmlns='http://jabber.org/protocol/pubsub'><subscribe node='/finesse/api/Queue/3' jid='1041@SERVER.com' /></pubsub>", function(data){
alert("success");
console.info(data);
});
}
};
jabberwerx._config.unsecureAllowed = true;
//Bind invoker function to any events that is received. Only invoke
//handler if XMPP message is in the specified structure.
_jwClient.event("messageReceived").bindWhen(
"event[xmlns='http://jabber.org/protocol/pubsub#event'] items item notification",
_eventHandler);
_jwClient.event("clientStatusChanged").bind(function(evt) {
});
//Connect to BOSH connection.
_jwClient.connect(jid, _password, jwArgs);
} else {
alert("CAXL library not found. Please download from http://developer.cisco.com/web/xmpp/resources")
}
}
Solved! Go to Solution.
10-26-2016 03:00 PM
Nevermind, I just had to move the sendIq function to be executed first on the successCallback.
successCallback: function () {
//Get the server generated resource ID to be used for subscriptions.
_jwClient.sendIq('set', "pubsub.SERVER.com", "<pubsub xmlns='http://jabber.org/protocol/pubsub'><subscribe node='/finesse/api/Queue/3' jid='1041@SERVER.com' /></pubsub>", function(data){
alert("success");
console.info(data);
});
_finesse.setResource(_jwClient.resourceName);
}
It is working now.
10-26-2016 03:00 PM
Nevermind, I just had to move the sendIq function to be executed first on the successCallback.
successCallback: function () {
//Get the server generated resource ID to be used for subscriptions.
_jwClient.sendIq('set', "pubsub.SERVER.com", "<pubsub xmlns='http://jabber.org/protocol/pubsub'><subscribe node='/finesse/api/Queue/3' jid='1041@SERVER.com' /></pubsub>", function(data){
alert("success");
console.info(data);
});
_finesse.setResource(_jwClient.resourceName);
}
It is working now.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide