MWSE/test.html

60 lines
1.7 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>
<h2><pre id="log"></pre></h2>
<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)=>{
gg.r++
gg()
});
iroom = room;
setInterval(()=>{
room.send({
type: "merhaba"
}, true)
gg.w++;
gg()
}, 200)
});
};
function gg()
{
log.innerHTML = `${gg.w} packet writed\n${gg.r} packet recaived`
}
gg.w = 0;
gg.r = 0;
/*setInterval(()=>{
window.location.reload();
}, 30000)*/
main();
</script>
</body>
</html>