fix kicked message for legacy implementation.

This commit is contained in:
Miroslav Šedivý 2024-09-07 20:10:43 +02:00
parent 4f401ac2b6
commit 82aa68097b
2 changed files with 11 additions and 1 deletions

View file

@ -47,7 +47,12 @@ func (session *SessionCtx) profileChanged() {
}
if (!session.profile.CanConnect || !session.profile.CanLogin || !session.profile.CanWatch) && session.state.IsWatching {
session.GetWebRTCPeer().Destroy()
// TODO: Needed for legacy implementation. Websocket must die before webrtc and deliver signal close message
// otherwise webrtc destroy would trigger websocket reconnect. In case of kick event, webrtc destroy is called
// before websocket destroy that delivers the information about the kick.
time.AfterFunc(time.Second, func() {
session.GetWebRTCPeer().Destroy()
})
}
if (!session.profile.CanConnect || !session.profile.CanLogin) && session.state.IsConnected {