function(message) {
        if (message.data.indexOf("<open ") === 0 || message.data.indexOf("<?xml") === 0) {
            // Strip the XML Declaration, if there is one
            var data = message.data.replace(/^(<\?.*?\?>\s*)*/, "");
            if (data === '') return;

            var streamStart = new DOMParser().parseFromString(data, "text/xml").documentElement;
            this._conn.xmlInput(streamStart);
            this._conn.rawInput(message.data);

            //_handleStreamSteart will check for XML errors and disconnect on error
            if (this._handleStreamStart(streamStart)) {
                //_connect_cb will check for stream:error and disconnect on error
                this._connect_cb(streamStart);
            }
        } else if (message.data.indexOf("<close ") === 0) { //'<close xmlns="urn:ietf:params:xml:ns:xmpp-framing />') {
            this._conn.rawInput(message.data);
            this._conn.xmlInput(message);
            var see_uri = message.getAttribute("see-other-uri");
            if (see_uri) {
                this._conn._changeConnectStatus(Strophe.Status.REDIRECT, "Received see-other-uri, resetting connection");
                this._conn.reset();
                this._conn.service = see_uri;
                this._connect();
            } else {
                this._conn._changeConnectStatus(Strophe.Status.CONNFAIL, "Received closing stream");
                this._conn._doDisconnect();
            }
        } else {
            var string = this._streamWrap(message.data);
            var elem = new DOMParser().parseFromString(string, "text/xml").documentElement;
            this.socket.onmessage = this._onMessage.bind(this);
            this._conn._connect_cb(elem, null, message.data);
        }
    }
function(message) {
        if (message.data.indexOf("<open ") === 0 || message.data.indexOf("<?xml") === 0) {
            // Strip the XML Declaration, if there is one
            var data = message.data.replace(/^(<\?.*?\?>\s*)*/, "");
            if (data === '') return;

            var streamStart = new DOMParser().parseFromString(data, "text/xml").documentElement;
            this._conn.xmlInput(streamStart);
            this._conn.rawInput(message.data);

            //_handleStreamSteart will check for XML errors and disconnect on error
            if (this._handleStreamStart(streamStart)) {
                //_connect_cb will check for stream:error and disconnect on error
                this._connect_cb(streamStart);
            }
        } else if (message.data.indexOf("<close ") === 0) { //'<close xmlns="urn:ietf:params:xml:ns:xmpp-framing />') {
            this._conn.rawInput(message.data);
            this._conn.xmlInput(message);
            var see_uri = message.getAttribute("see-other-uri");
            if (see_uri) {
                this._conn._changeConnectStatus(Strophe.Status.REDIRECT, "Received see-other-uri, resetting connection");
                this._conn.reset();
                this._conn.service = see_uri;
                this._connect();
            } else {
                this._conn._changeConnectStatus(Strophe.Status.CONNFAIL, "Received closing stream");
                this._conn._doDisconnect();
            }
        } else {
            var string = this._streamWrap(message.data);
            var elem = new DOMParser().parseFromString(string, "text/xml").documentElement;
            this.socket.onmessage = this._onMessage.bind(this);
            this._conn._connect_cb(elem, null, message.data);
        }
    }
function ( message ) { if ( message . data . indexOf ( "<open " ) === 0 || message . data . indexOf ( "<?xml" ) === 0 ) { // Strip the XML Declaration, if there is one
 var data = message . data . replace ( / ^(<\?.*?\?>\s*)* / , "" ) ; if ( data === '' ) return ; var streamStart = new DOMParser ( ) . parseFromString ( data , "text/xml" ) . documentElement ; this . _conn . xmlInput ( streamStart ) ; this . _conn . rawInput ( message . data ) ; //_handleStreamSteart will check for XML errors and disconnect on error
 if ( this . _handleStreamStart ( streamStart ) ) { //_connect_cb will check for stream:error and disconnect on error
 this . _connect_cb ( streamStart ) ; } } else if ( message . data . indexOf ( "<close " ) === 0 ) { //'<close xmlns="urn:ietf:params:xml:ns:xmpp-framing />') {
 this . _conn . rawInput ( message . data ) ; this . _conn . xmlInput ( message ) ; var see_uri = message . getAttribute ( "see-other-uri" ) ; if ( see_uri ) { this . _conn . _changeConnectStatus ( Strophe . Status . REDIRECT , "Received see-other-uri, resetting connection" ) ; this . _conn . reset ( ) ; this . _conn . service = see_uri ; this . _connect ( ) ; } else { this . _conn . _changeConnectStatus ( Strophe . Status . CONNFAIL , "Received closing stream" ) ; this . _conn . _doDisconnect ( ) ; } } else { var string = this . _streamWrap ( message . data ) ; var elem = new DOMParser ( ) . parseFromString ( string , "text/xml" ) . documentElement ; this . socket . onmessage = this . _onMessage . bind ( this ) ; this . _conn . _connect_cb ( elem , null , message . data ) ; } }
PrivateFunction: _connect_cb_wrapper
_Private_ function that handles the first connection messages.

On receiving an opening stream tag this callback replaces itself with the real
message handler. On receiving a stream error the connection is terminated.
PrivateFunction : _connect_cb_wrapper _Private_ function that handles the first connection messages .
Handle message from the device