From fc031c16d4fff895413d74b65122f8cf9076a789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sat, 17 Jul 2021 16:08:12 +0200 Subject: [PATCH] reconnect disconnect on close. --- src/component/internal/connection.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/component/internal/connection.ts b/src/component/internal/connection.ts index c58e5176..cb641f4d 100644 --- a/src/component/internal/connection.ts +++ b/src/component/internal/connection.ts @@ -120,7 +120,7 @@ export class NekoConnection extends EventEmitter { } }) this._websocket_reconn.on('close', (error) => { - this.emit('disconnect', error) + this.disconnect(error) }) // webrtc @@ -139,7 +139,7 @@ export class NekoConnection extends EventEmitter { Vue.set(this._state, 'type', 'screencast') }) this._webrtc_reconn.on('close', (error) => { - this.emit('disconnect', error) + this.disconnect(error) }) let webrtcCongestion: number = 0 @@ -205,16 +205,17 @@ export class NekoConnection extends EventEmitter { Vue.set(this._state.webrtc, 'video', video) } + Vue.set(this._state, 'status', 'connecting') this._webrtc_reconn.open(true) this._websocket_reconn.open() } - public disconnect() { + public disconnect(error?: Error) { this._websocket_reconn.close() this._webrtc_reconn.close() Vue.set(this._state, 'status', 'disconnected') - this.emit('disconnect') + this.emit('disconnect', error) } _webrtcQualityDowngrade(quality: string): string | undefined {