Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error calling requestAcknowledgement, "Higher reported acknowledge count than unacknowledged stanzas." #2

Open
eugeniumegherea opened this issue Apr 12, 2018 · 3 comments

Comments

@eugeniumegherea
Copy link

Tried to implement message delivery ack requests and every time, requestAcknowledgement function was throwing error from line 230.

Upon investigating found out that xmlOutput function seems to not handle properly element tag name detection. Because of that, _unacknowledgedStanzas array is always empty

xmlOutput: function (elem) {
  // elem is a HTMLElement with iq, presence or message as root element
  var child;
  for (var i = 0; i < elem.children.length; i++) {
    child = elem.children[i];
    // this if will never be true because iq, presence and message
    // are never child elements, they are root elements
    if (Strophe.isTagEqual(child, 'iq') ||
      Strophe.isTagEqual(child, 'presence') ||
      Strophe.isTagEqual(child, 'message')) {
      this._increaseSentStanzasCounter(child);
    }
  }

  return this._originalXMLOutput.call(this._c, elem);
},

As a workaround, I wrapped initial elem in another HTMLElement and it seems to be working that way. Is this the intended way or am I missing something?

@mayurtailor009
Copy link

@eugeniumegherea :- How to use strophejs-plugin-stream-management plugin in reactjs ?
Can you please provide steps ?

@zainulhasan
Copy link

_originalXMLOutput

I am having the same issue. It will be very helpful if share your solution. Thanks

@mailtosagar
Copy link

mailtosagar commented Jul 23, 2019

Hi,
I am using react and strophe. Strophe always available as a global object( window obect ). So What you can do is

  1. Link all the js file in HTML
  2. make a connection.js file in the component folder (or where you write all your components). export strophe and strophe builders from there.
    Like:
    export const strophe = window.Strophe;
    const conn = new strophe.Connection('http://localhost:5280/http-bind');
    export const onlineStatus = () => window.$pres();
    export const pres = (sendingDetails) => window.$pres(sendingDetails);
    export const msg = (sendingDetails) => window.$msg(sendingDetails);
    export const iq = (sendingDetails) => window.$iq(sendingDetails);
  3. Import and use any plugin
    strophe.plugin.function();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants