add reconn delay.

This commit is contained in:
Miroslav Šedivý 2021-06-24 15:40:11 +02:00
parent 6a8255d08a
commit 6e92022c37

View File

@ -8,7 +8,10 @@ import { NekoWebRTC, WebRTCStats } from './webrtc'
import { Connection } from '../types/state' import { Connection } from '../types/state'
const websocketTimer = 1000 const websocketTimer = 1000
const websocketReconnDelay = 750
const webrtcTimer = 10000 const webrtcTimer = 10000
const webrtcReconnDelay = 750
export interface NekoConnectionEvents { export interface NekoConnectionEvents {
disconnect: (error?: Error) => void disconnect: (error?: Error) => void
@ -185,7 +188,7 @@ export class NekoConnection extends EventEmitter<NekoConnectionEvents> {
this._websocketIsReconnecting = false this._websocketIsReconnecting = false
this._log.debug(`websocket reconnection finished`) this._log.debug(`websocket reconnection finished`)
}, 0) }, websocketReconnDelay)
} }
async _webrtcConnect(video?: string) { async _webrtcConnect(video?: string) {
@ -238,7 +241,7 @@ export class NekoConnection extends EventEmitter<NekoConnectionEvents> {
this._webrtcIsReconnecting = false this._webrtcIsReconnecting = false
this._log.debug(`webrtc reconnection finished`) this._log.debug(`webrtc reconnection finished`)
}, 0) }, webrtcReconnDelay)
} }
_webrtcQualityDowngrade(quality: string): string | undefined { _webrtcQualityDowngrade(quality: string): string | undefined {