deferredConnection for reconnecter.

This commit is contained in:
Miroslav Šedivý 2021-07-15 23:55:48 +02:00
parent 78cefb95b7
commit efe04c62ed

View File

@ -119,14 +119,17 @@ export class Reconnecter extends EventEmitter<ReconnecterEvents> {
} }
} }
public open(): void { public open(deferredConnection = false): void {
if (this._open) { if (this._open) {
throw new Error('connection is already open') throw new Error('connection is already open')
} }
this._open = true this._open = true
this.emit('open') this.emit('open')
this.connect()
if (!deferredConnection) {
this.connect()
}
} }
public close(error?: Error): void { public close(error?: Error): void {