docs: function(message) {
          var elem, data;
          // check for closing stream
          var close = '<close xmlns="urn:ietf:params:xml:ns:xmpp-framing" />';
          if (message.data === close) {
              this._conn.rawInput(close);
              this._conn.xmlInput(message);
              if (!this._conn.disconnecting) {
                  this._conn._doDisconnect();
              }
              return;
          } else if (message.data.search("<open ") === 0) {
              // This handles stream restarts
              elem = new DOMParser().parseFromString(message.data, "text/xml").documentElement;
  
              if (!this._handleStreamStart(elem)) {
                  return;
              }
          } else {
              data = this._streamWrap(message.data);
              elem = new DOMParser().parseFromString(data, "text/xml").documentElement;
          }
  
          if (this._check_streamerror(elem, Strophe.Status.ERROR)) {
              return;
          }
  
          //handle unavailable presence stanza before disconnecting
          if (this._conn.disconnecting &&
                  elem.firstChild.nodeName === "presence" &&
                  elem.firstChild.getAttribute("type") === "unavailable") {
              this._conn.xmlInput(elem);
              this._conn.rawInput(Strophe.serialize(elem));
              // if we are already disconnecting we will ignore the unavailable stanza and
              // wait for the </stream:stream> tag before we close the connection
              return;
          }
          this._conn._dataRecv(elem, message.data);
      }