MWSE/test.html

64 lines
2.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>
<h1 id="message"></h1>
<script src="./script/index.js"></script>
<script>
async function main(){
const wsjs = new MWSE({
endpoint: "ws://localhost:7707"
});
wsjs.scope(async ()=>{
let me = wsjs.peer('me');
me.disablePairAuth();
console.log(me.socketId);
let room = wsjs.room({
accessType: "public",
description: "Benim odam",
joinType: "free",
name: "M.E.",
notifyActionInvite: true,
notifyActionJoined: true,
notifyActionEjected: false,
ifexistsJoin: true
});
await room.createRoom();
room.on('message',(...args)=>{
console.log(args)
});
iroom = room;
/*setInterval(()=>{
wsjs.server.tranferToServer({
e0:Math.random(),
e1:Math.random(),
e2:Math.random(),
e3:Math.random(),
e4:Math.random()
})
}, 10)*/
});
wsjs.on('peer',(peer)=>{
peer.on('message',(...args)=>{
console.log(args);
})
})
};
let ws = new WebSocket("ws://localhost:7707");
ws.onmessage = function({data}){
message.innerText = data;
}
// main();
/*for (const iterator of Array.from({length:90}).fill(0)) {
main();
}*/
</script>
</body>
</html>