How can I make a browser to browser (peer to peer) connection in HTML?

For the browser to browser connection, follow the below-given steps −

All the following library −

<script src = ""></script>

Create a peer −

For creating a peer, you need to get a free API key.

var peer = new Peer('pick-an-id', {key: 'myapikey'});

Connect −

var conn = peer.connect('another-peers-id');
conn.on('open', function(){

Updated on: 24-Jun-2020


Kickstart Your Career

Get certified by completing the course

Get Started