AnsweredAssumed Answered

Trying to subscribe to pubsub queues notifications

Question asked by armandoramirez on Oct 26, 2016
Latest reply on Oct 26, 2016 by armandoramirez

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")
    }
}

Outcomes