mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
reconnect disconnect on close.
This commit is contained in:
parent
0408acd211
commit
fc031c16d4
@ -120,7 +120,7 @@ export class NekoConnection extends EventEmitter<NekoConnectionEvents> {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
this._websocket_reconn.on('close', (error) => {
|
this._websocket_reconn.on('close', (error) => {
|
||||||
this.emit('disconnect', error)
|
this.disconnect(error)
|
||||||
})
|
})
|
||||||
|
|
||||||
// webrtc
|
// webrtc
|
||||||
@ -139,7 +139,7 @@ export class NekoConnection extends EventEmitter<NekoConnectionEvents> {
|
|||||||
Vue.set(this._state, 'type', 'screencast')
|
Vue.set(this._state, 'type', 'screencast')
|
||||||
})
|
})
|
||||||
this._webrtc_reconn.on('close', (error) => {
|
this._webrtc_reconn.on('close', (error) => {
|
||||||
this.emit('disconnect', error)
|
this.disconnect(error)
|
||||||
})
|
})
|
||||||
|
|
||||||
let webrtcCongestion: number = 0
|
let webrtcCongestion: number = 0
|
||||||
@ -205,16 +205,17 @@ export class NekoConnection extends EventEmitter<NekoConnectionEvents> {
|
|||||||
Vue.set(this._state.webrtc, 'video', video)
|
Vue.set(this._state.webrtc, 'video', video)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vue.set(this._state, 'status', 'connecting')
|
||||||
this._webrtc_reconn.open(true)
|
this._webrtc_reconn.open(true)
|
||||||
this._websocket_reconn.open()
|
this._websocket_reconn.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
public disconnect() {
|
public disconnect(error?: Error) {
|
||||||
this._websocket_reconn.close()
|
this._websocket_reconn.close()
|
||||||
this._webrtc_reconn.close()
|
this._webrtc_reconn.close()
|
||||||
|
|
||||||
Vue.set(this._state, 'status', 'disconnected')
|
Vue.set(this._state, 'status', 'disconnected')
|
||||||
this.emit('disconnect')
|
this.emit('disconnect', error)
|
||||||
}
|
}
|
||||||
|
|
||||||
_webrtcQualityDowngrade(quality: string): string | undefined {
|
_webrtcQualityDowngrade(quality: string): string | undefined {
|
||||||
|
Loading…
Reference in New Issue
Block a user