/** handle actual disconnecting - from ui thread only */
  void doDisconnect() {
    mState = State.kDisconnecting;
    for (RoomObserver obs : mObservers) {
      obs.onRoomDisconnected();
    }
    Set<String> keyset = mRemoteStream.keySet();
    for (String key : keyset) {
      StreamDescription stream = (StreamDescription) mRemoteStream.get(key);
      removeStream(stream);
      triggerStreamRemoved(stream);
    }
    mRemoteStream.clear();

    if (mLocalStream.size() > 0) {
      unpublish();
    }

    synchronized (mSocketLock) {
      if (mIoClient != null) {
        mIoClient.disconnect();
        mIoClient = null;
      }
    }

    mState = State.kDisconnected;
  }
        @Override
        public void onEvent(JSONArray args, Acknowledge ack) {
          // [{"id":331051653483882560}]
          log("mOnRemoveStream");

          try {
            JSONObject param = args.getJSONObject(0);
            String streamId = param.getString("id");
            StreamDescription stream = (StreamDescription) mRemoteStream.get(streamId);

            if (stream != null) {
              removeStream(stream);
              mRemoteStream.remove(streamId);
              triggerStreamRemoved(stream);
            }
          } catch (JSONException e) {
          }
        }
 void removeStream(StreamDescription stream) {
   stream.onClosing();
   triggerStreamRemoved(stream);
 }