39 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			HTML
		
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			HTML
		
	
	
	
<!DOCTYPE html>
 | 
						|
<html lang="en">
 | 
						|
<head>
 | 
						|
    <meta charset="UTF-8">
 | 
						|
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
 | 
						|
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
						|
    <title>Document</title>
 | 
						|
</head>
 | 
						|
<body>
 | 
						|
    <script src="./script/index.js"></script>
 | 
						|
    <script>
 | 
						|
        var wsjs;
 | 
						|
        async function main(){
 | 
						|
            wsjs = new MWSE({
 | 
						|
                endpoint: "ws://localhost:7707"
 | 
						|
            });
 | 
						|
            wsjs.scope(()=>{
 | 
						|
                let me = wsjs.peer('me');
 | 
						|
                me.disablePairAuth();
 | 
						|
                console.log(me.socketId);
 | 
						|
                me.on('message',(...args)=>{
 | 
						|
                    console.log(args);
 | 
						|
                })
 | 
						|
            });
 | 
						|
            wsjs.on('peer',(peer)=>{
 | 
						|
                peer.on('message',(...args)=>{
 | 
						|
                    console.log(args);
 | 
						|
                })
 | 
						|
            })
 | 
						|
        };
 | 
						|
        main();
 | 
						|
        function sendMessage(id)
 | 
						|
        {
 | 
						|
            let me = wsjs.peer(id);
 | 
						|
            me.send("Merhaba");
 | 
						|
        }
 | 
						|
    </script>
 | 
						|
</body>
 | 
						|
</html> |