(peers)
| 379 | } |
| 380 | |
| 381 | _onPeers(peers) { |
| 382 | peers.forEach(peer => { |
| 383 | if (this.peers[peer.id]) { |
| 384 | this.peers[peer.id].refresh(); |
| 385 | return; |
| 386 | } |
| 387 | if (window.isRtcSupported && peer.rtcSupported) { |
| 388 | this.peers[peer.id] = new RTCPeer(this._server, peer.id); |
| 389 | } else { |
| 390 | this.peers[peer.id] = new WSPeer(this._server, peer.id); |
| 391 | } |
| 392 | }) |
| 393 | } |
| 394 | |
| 395 | sendTo(peerId, message) { |
| 396 | this.peers[peerId].send(message); |