[test] close peer

This commit is contained in:
kwaroran
2023-11-22 19:59:54 +09:00
parent b53e369d7b
commit 96f7938e5f

View File

@@ -35,6 +35,7 @@ export async function createMultiuserRoom(){
peer.on('connection', function(conn) {
connections.push(conn)
console.log("new connection", conn)
function requestChar(){
const db = get(DataBase)
const selectedCharId = get(selectedCharID)
@@ -65,6 +66,15 @@ export async function createMultiuserRoom(){
sendPeerChar()
}
});
conn.on('close', function() {
for(let i = 0; i < connections.length; i++){
if(connections[i].connectionId === conn.connectionId){
connections.splice(i, 1)
break
}
}
})
});
while(!open){
await sleep(100)