Untitled - MARKUP 0.91 KB
                                
                                    <html>
    <head></head>
    <body>
        <p>Hello 2</p>
        <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/peer.min.js"></script>
        <script>
            var peer = new Peer('just4600');

            peer.on('open', function(id) {
                console.log('My peer ID is: ' + id);

                peer.on('connection', function(conn){
                    conn.on('open', function() {

                        console.log("opened connection with peer")

                        // Receive messages
                        conn.on('data', function(data) {
                            console.log(data)
                            alert(data);
                        });
                    });
                });
            });
        </script>
    </body>
</html>
                                
                            

Paste Hosted With By Online Notepad - Store and share your free text online.