Fixing disconnection taking ~15 seconds
Most of the time, sending a disconnect event to one of the players is enough (the player will close the connection which will be shut for the other player). However! In the rare case where the WebRTC connection is not yet established, if we close the connection on one of the player, the other player will try connecting until a timeout happens (during this time, the circle with the name is displayed for nothing). So now, we send disconnection event to every body (not only the people in the group, but also to the person leaving the group)
This commit is contained in:
parent
b82b13e351
commit
96c5d92c46
3 changed files with 57 additions and 17 deletions
|
@ -388,6 +388,17 @@ export class IoSocketController {
|
|||
userId: userId
|
||||
});
|
||||
|
||||
// Most of the time, sending a disconnect event to one of the players is enough (the player will close the connection
|
||||
// which will be shut for the other player).
|
||||
// However! In the rare case where the WebRTC connection is not yet established, if we close the connection on one of the player,
|
||||
// the other player will try connecting until a timeout happens (during this time, the connection icon will be displayed for nothing).
|
||||
// So we also send the disconnect event to the other player.
|
||||
for (let user of group.getUsers()) {
|
||||
Client.emit(SockerIoEvent.WEBRTC_DISCONNECT, {
|
||||
userId: user.id
|
||||
});
|
||||
}
|
||||
|
||||
//disconnect webrtc room
|
||||
if(!Client.webRtcRoomId){
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue