[test] close peer
This commit is contained in:
@@ -35,6 +35,7 @@ export async function createMultiuserRoom(){
|
|||||||
peer.on('connection', function(conn) {
|
peer.on('connection', function(conn) {
|
||||||
connections.push(conn)
|
connections.push(conn)
|
||||||
console.log("new connection", conn)
|
console.log("new connection", conn)
|
||||||
|
|
||||||
function requestChar(){
|
function requestChar(){
|
||||||
const db = get(DataBase)
|
const db = get(DataBase)
|
||||||
const selectedCharId = get(selectedCharID)
|
const selectedCharId = get(selectedCharID)
|
||||||
@@ -65,6 +66,15 @@ export async function createMultiuserRoom(){
|
|||||||
sendPeerChar()
|
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){
|
while(!open){
|
||||||
await sleep(100)
|
await sleep(100)
|
||||||
|
|||||||
Reference in New Issue
Block a user