proper disconnect.

This commit is contained in:
m1k1o 2021-03-19 20:16:08 +01:00
parent bbea5f5715
commit 9771b551df
2 changed files with 31 additions and 4 deletions

View File

@ -41,6 +41,7 @@ For n.eko room management software visit https://github.com/m1k1o/neko-rooms.
- Fixed sessions manager thread safety by adding mutexes (caused panic in rare edge cases). - Fixed sessions manager thread safety by adding mutexes (caused panic in rare edge cases).
- Now when user gets kicked, he won't join as a ghost user again but will be logged out. - Now when user gets kicked, he won't join as a ghost user again but will be logged out.
- **iOS compatibility!** Fixed really strange CSS bug, which prevented iOS from loading the video. - **iOS compatibility!** Fixed really strange CSS bug, which prevented iOS from loading the video.
- Proper disconnect only once with unsubscribing events. When webrtc fails, user won't be logged in without username again.
### Misc ### Misc
- Custom docker workflow. - Custom docker workflow.

View File

@ -76,17 +76,43 @@ export abstract class BaseClient extends EventEmitter<BaseEvents> {
clearTimeout(this._timeout) clearTimeout(this._timeout)
} }
if (this.socketOpen) { if (this._ws) {
// reset all events
this._ws.onmessage = () => {}
this._ws.onerror = () => {}
this._ws.onclose = () => {}
try { try {
this._ws!.close() this._ws.close()
} catch (err) {} } catch (err) {}
this._ws = undefined this._ws = undefined
} }
if (this.peerConnected) { if (this._channel) {
// reset all events
this._channel.onmessage = () => {}
this._channel.onerror = () => {}
this._channel.onclose = () => {}
try { try {
this._peer!.close() this._channel.close()
} catch (err) {} } catch (err) {}
this._channel = undefined
}
if (this._peer) {
// reset all events
this._peer.onconnectionstatechange = () => {}
this._peer.onsignalingstatechange = () => {}
this._peer.oniceconnectionstatechange = () => {}
this._peer.ontrack = () => {}
try {
this._peer.close()
} catch (err) {}
this._peer = undefined this._peer = undefined
} }