close() {
    if (!~[CLOSED, CLOSING].indexOf(this.status)) { // eslint-disable-line no-bitwise
      this.status = CLOSING;
      // Stop listening to Subscribers
      const path = `_/rooms/${this.roomId}/subscribers/${this.uid}`;
      DataSync.off(path, 'child_added');
      DataSync.off(path, 'child_removed');
      // Cancel onDisconnects
      DataSync.onDisconnect(`_/rooms/${this.roomId}/streams/${this.uid}`).cancel();
      DataSync.onDisconnect(`_/rooms/${this.roomId}/subscribers/${this.uid}`).cancel();
      // Remove subscribers
      DataSync.remove(path);
      // Remove stream
      DataSync.remove(`_/rooms/${this.roomId}/streams/${this.uid}`);
      this.media = null;
      // Close
      this.status = CLOSED;
    }
    return Promise.resolve(this.status);
  }
/**
   * Removes stream for published list, closes associated
   * PeerConnections and stops current MediaStream
   * @returns {Promise}
   */
Removes stream for published list, closes associated
PeerConnections and stops current MediaStream
@returns {Promise}
Removes stream for published list closes associated PeerConnections and stops current MediaStream @returns { Promise }
close() {
    if (!~[CLOSED, CLOSING].indexOf(this.status)) { 
      this.status = CLOSING;
      const path = `_/rooms/${this.roomId}/subscribers/${this.uid}`;
      DataSync.off(path, 'child_added');
      DataSync.off(path, 'child_removed');
      DataSync.onDisconnect(`_/rooms/${this.roomId}/streams/${this.uid}`).cancel();
      DataSync.onDisconnect(`_/rooms/${this.roomId}/subscribers/${this.uid}`).cancel();
      DataSync.remove(path);
      DataSync.remove(`_/rooms/${this.roomId}/streams/${this.uid}`);
      this.media = null;
      this.status = CLOSED;
    }
    return Promise.resolve(this.status);
  }
close ( ) { if ( ! ~ [ CLOSED , CLOSING ] . indexOf ( this . status ) ) { this . status = CLOSING ; const path = ` ${ this . roomId } ${ this . uid } ` ; DataSync . off ( path , 'child_added' ) ; DataSync . off ( path , 'child_removed' ) ; DataSync . onDisconnect ( ` ${ this . roomId } ${ this . uid } ` ) . cancel ( ) ; DataSync . onDisconnect ( ` ${ this . roomId } ${ this . uid } ` ) . cancel ( ) ; DataSync . remove ( path ) ; DataSync . remove ( ` ${ this . roomId } ${ this . uid } ` ) ; this . media = null ; this . status = CLOSED ; } return Promise . resolve ( this . status ) ; }
Removes stream for published list, closes associated
 PeerConnections and stops current MediaStream
 @returns {Promise}
Removes stream for published list closes associated PeerConnections and stops current MediaStream @returns { Promise }
// eslint-disable-line no-bitwise // Stop listening to Subscribers // Cancel onDisconnects // Remove subscribers // Remove stream // Close