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

if server acks during authentication, strophe stops and does not error #47

Open
brookswift opened this issue Apr 27, 2011 · 1 comment

Comments

@brookswift
Copy link

I've run into an issue with my openfire server where sometimes (1 in 2 to 1 in 30 attempts) during the authentication flow, I get an ack from the server instead of a proper response. Because the long polls are not yet set up in the authentication flow, no handlers get called and strophe pretty much just does nothing.

I wrote a fix in the _dataRecv handler to handle this case by re-sending a request to the server

    // if server returns an ack during the auth flow, reconnect for response
    if (elem.getAttribute("ack") && !this.authenticated) {
        this.rid = elem.getAttribute("ack");
        var body = this._buildBody();
        var newReq = new Strophe.Request(body.tree(),
                this._onRequestStateChange.bind(this).prependArg(this._dataRecv.bind(this)), elem.getAttribute("ack"));
        this._requests.push(newReq);
        this._processRequest(this._requests.length - 1);
    }

I didn't handle it, but if the server sends some other unexpected response, then strophe will still stall out without any error condition. There should be some sort of error handling for unexpected server responses during the authentication flow, before the long polls are initialized.

@leonroy
Copy link

leonroy commented Dec 20, 2012

Where in the _dataRecv handler did you put that code?

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

2 participants