matchmaking: add: clear message if normal closure
This commit is contained in:
parent
88aca3a54b
commit
397344ee45
@ -39,7 +39,7 @@ class MatchMaking
|
||||
onclose(event)
|
||||
{
|
||||
this.stop();
|
||||
this.disconnect_func()
|
||||
this.disconnect_func(event);
|
||||
}
|
||||
|
||||
async stop()
|
||||
|
@ -25,8 +25,10 @@ export default class extends AbstractAuthentifiedView {
|
||||
}
|
||||
}
|
||||
|
||||
ondisconnect()
|
||||
ondisconnect(event)
|
||||
{
|
||||
if (event.code === 1000)
|
||||
clear("innerText", ["detail"])
|
||||
document.getElementById("button").value = "Find a game"
|
||||
}
|
||||
|
||||
|
@ -38,4 +38,4 @@ class MatchMaking(WebsocketConsumer):
|
||||
waiting_room: WaitingRoom = normal.get(self.mode)
|
||||
waiter: Waiter = waiting_room.get_member_by_socket(self)
|
||||
if (waiter is not None):
|
||||
waiting_room.remove(waiter)
|
||||
waiting_room.remove(waiter, 1016)
|
@ -35,9 +35,9 @@ class AbstractRoom:
|
||||
self._member_list.append(waiter)
|
||||
member.accept()
|
||||
|
||||
def remove(self, member: AbstractRoomMember):
|
||||
def remove(self, member: AbstractRoomMember, code: int = 1000):
|
||||
self._member_list.remove(member)
|
||||
member.disconnect()
|
||||
member.disconnect(code)
|
||||
|
||||
def empty(self):
|
||||
for _ in self._member_list:
|
||||
|
@ -16,5 +16,5 @@ class AbstractRoomMember:
|
||||
def accept(self):
|
||||
self.socket.accept()
|
||||
|
||||
def disconnect(self):
|
||||
self.socket.disconnect(200)
|
||||
def disconnect(self, code: int = 1000):
|
||||
self.socket.disconnect(code)
|
Loading…
Reference in New Issue
Block a user