Q: Cannot send message to other end using PeerJs connection What I am trying to achieve is building a WebRtc application to support data and video exchange using PeerJs. My component.ts looks something like this:


ngOnInit() {
    this.peer = new Peer();
    setTimeout(() => {
      this.mypeerid = this.peer.id;
    },3000);
    this.peer.on('connection', function(conn) {
       conn.on('data', function(data){
           console.log(data);
       });
    });
  }

  connect(){
    var conn = this.peer.connect(this.secondId.nativeElement.value);
    console.log(conn);
    conn.on('open', function(){
      conn.send('Message from that id');
    });
  }


The component.html looks like: 


<h1>My id - {{mypeerid}}</h1>
<input type="text" #secondId>
<button (click)="connect()">Connect</button>


I would mention along with this that I have added the statement declare var Peer: any in typings.d.ts
The code runs well but unfortunately, conn.send('Message from that id') doesn't send console.log message at the other end. 
