Conditions for stream:error stanzas not available #58

Open
SilentChris opened this Issue Aug 9, 2011 · 0 comments

Comments

Projects
None yet
1 participant
@SilentChris

We're using the defined conditions for stream:errors to display detailed error messaging to users when they get disconnected. It appears that strophe isn't handling any condition nodes other than "conflict" which it checks for specifically and forwards on.

One example of the handling is around the _dataRecv function in core.js:

    var typ = elem.getAttribute("type");
    var cond, conflict;
    if (typ !== null && typ == "terminate") {
        // an error occurred
        cond = elem.getAttribute("condition");
        conflict = elem.getElementsByTagName("conflict");
        if (cond !== null) {
            if (cond == "remote-stream-error" && conflict.length > 0) {
                cond = "conflict";
            }
            this._changeConnectStatus(Strophe.Status.CONNFAIL, cond);
        } else {
            this._changeConnectStatus(Strophe.Status.CONNFAIL, "unknown");
        }
        this.disconnect();
        return;
    }

The spec for the stream:error and condition nodes that I'm referring to is at http://xmpp.org/rfcs/rfc3920.html#rfc.section.4.7.2

Basically, we send data along the lines of:

<stream:error xmlns:stream='http://etherx.jabber.org/streams'>
    <system-shutdown xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
    <text xmlns='urn:ietf:params:xml:ns:xmpp-streams'>
        The system is being shut down for an upgrade. Please wait a moment before reconnecting.
    </text>
</stream:error>

I'm trying get the "system-shutdown" and "text" nodes in order to display some more specific messaging beyond "You have been disconnected" to the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment