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

HTMLJavascriptProgramming Scripts

<p style="">For the browser to browser connection, follow the below-given steps &minus;</p><p>All the following library &minus;</p><pre class="result notranslate">&lt;script src = &quot;http://cdn.peerjs.com/0.3/peer.js&quot;&gt;&lt;/script&gt;</pre><p>Create a peer &minus;</p><p>For creating a peer, you need to get a free API key.</p><pre class="result notranslate">var peer = new Peer(&#39;pick-an-id&#39;, {key: &#39;myapikey&#39;});</pre><p style="">Connect &minus;</p><pre class="result notranslate">var conn = peer.connect(&#39;another-peers-id&#39;); conn.on(&#39;open&#39;, function(){ &nbsp; &nbsp;conn.send(&#39;Welcome!&#39;); });</pre>
raja
Updated on 24-Jun-2020 13:44:32

Advertisements