send leave when client reconnects on server restart (#43)

This commit is contained in:
David Colburn
2021-07-08 01:37:21 -05:00
committed by GitHub
parent ec2d7a49cd
commit 145f058eaa
3 changed files with 16 additions and 3 deletions
+13
View File
@@ -245,6 +245,19 @@ func (r *RoomManager) StartSession(roomName string, pi routing.ParticipantInit,
// we need to clean up the existing participant, so a new one can join
room.RemoveParticipant(participant.Identity())
}
} else if pi.Reconnect {
// send leave request if participant is trying to reconnect but missing from the room
if err = responseSink.WriteMessage(&livekit.SignalRequest{
Message: &livekit.SignalRequest_Leave{
Leave: &livekit.LeaveRequest{
CanReconnect: true,
},
},
}); err != nil {
logger.Warnw("could not restart participant", err,
"participant", pi.Identity)
}
return
}
logger.Debugw("starting RTC session",