title: Can't close connection beetween peer on peerjs
body: <p>I'm trying to make video chat app, and it works with peerjs. Now I want to add some functionality to handle scenarios like if connection is destroyed by user, the other user that connected to him gets a notification.</p>
  <p>Here's my code for calling other user:</p>
  <pre class="lang-js prettyprint-override"><code> call(userId: string, partnerId: string) {
      const conn = this.peer.connect(partnerId);
      conn.on('open', () =&gt; {
        conn.on('data', (data) =&gt; {
          console.log(data);
        })
        conn.send(userId);
      })
      if (this.peer.destroyed) {
        this.createPeer(this.userId);
      }
  
      if (this.myEl.classList.contains('disableCall')) {
        console.log('Show');
        this.myEl.classList.add('showCall');
        this.partnerEl.classList.add('showCall');
        this.myEl.classList.remove('disableCall');
        this.partnerEl.classList.remove('disableCall');
      }
      this.hideCallLogin = false;
      const call = this.peer.call(partnerId, this.myStream);
      this.mediaConnection = call;
      call.on('stream', (stream) =&gt; {
        this.partnerEl.srcObject = stream;
        this.hideCall = true;
        this.hideCallLogin = false;
        if (call.peerConnection.connectionState == 'connecting') {
          this.swapVideo('my-video');
        }
      });
      call.on('close', () =&gt; {
        console.log('Di hentikan oleh penerima');
        this.mediaConnection.close();
        this.myEl.classList.remove('showCall');
        this.partnerEl.classList.remove('showCall');
        this.myEl.classList.add('disableCall');
        this.partnerEl.classList.add('disableCall');
        this.hideCall = false;
        this.hideCallLogin = false;
      })
    }
  </code></pre>
  <p>Here's how other user answers:</p>
  <pre class="lang-js prettyprint-override"><code>wait() {
      this.peer.on('call', (call) =&gt; {
        this.mediaConnection = call;
        //change this to a modal for confirm a call
        var acceptsCall = confirm(partner + &quot; is calling, do you want to accept it ?&quot;);
        if (acceptsCall) {
          call.answer(this.myStream); // Answer the call with an A/V stream.
          call.on('stream', (stream) =&gt; {
            if (this.myEl.classList.contains('disableCall')) {
              console.log('Show');
              this.partnerEl.classList.add('showCall');
              this.myEl.classList.add('showCall');
              this.partnerEl.classList.remove('disableCall');
              this.myEl.classList.remove('disableCall');
            }
            this.partnerEl.srcObject = stream;
            this.status = 'Connected';
            this.hideCallLogin = false;
            this.swapVideo('my-video');
          });
          call.on('close', () =&gt; {
            console.log('Di hentikan oleh penelpon');
            this.myEl.classList.remove('showCall');
            this.partnerEl.classList.remove('showCall');
            this.myEl.classList.add('disableCall');
            this.partnerEl.classList.add('disableCall');
            console.log(this.status);
            this.hideCall = false;
            this.hideCallLogin = false;
          })
        }
      });
      //getting partner id
      let partner = '';
      this.peer.on('connection', (conn) =&gt; {
        conn.on('open', () =&gt; {
          conn.on('data', (data) =&gt; {
            partner = data;
          })
        })
      })
  
    }
  </code></pre>
  <p>What I want is peers disconnect or destroyed if 1 peer hangs up, and it automatically closes their video. Anyone know how to do that?</p>