mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
Disconnect WebRTC on socket disconnect.
This commit is contained in:
parent
7eee6debc7
commit
4670b5187c
@ -113,13 +113,19 @@ func (session *SessionCtx) SetWebSocketPeer(websocket_peer types.WebSocketPeer)
|
||||
}
|
||||
|
||||
func (session *SessionCtx) SetWebSocketConnected(connected bool) {
|
||||
session.websocket_connected = connected
|
||||
|
||||
if connected {
|
||||
session.websocket_connected = true
|
||||
session.manager.emmiter.Emit("connected", session)
|
||||
} else {
|
||||
session.websocket_connected = false
|
||||
return
|
||||
}
|
||||
|
||||
session.manager.emmiter.Emit("disconnected", session)
|
||||
session.websocket_peer = nil
|
||||
|
||||
// TODO: Refactor. Only if is WebRTC active.
|
||||
if err := session.webrtc_peer.Destroy(); err != nil {
|
||||
session.logger.Warn().Err(err).Msgf("webrtc destroy has failed")
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user