From c2e3a39142f5d9dc7a6aab0b11ef5f37c4e19791 Mon Sep 17 00:00:00 2001 From: Nguyen Truong Date: Wed, 21 Jul 2021 20:49:25 +0700 Subject: [PATCH] refactor: wait for SFU joined then call `onjoin` (#206) --- src/ion.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ion.ts b/src/ion.ts index ffe2992f..68f265c3 100644 --- a/src/ion.ts +++ b/src/ion.ts @@ -89,9 +89,6 @@ export class IonConnector { this._biz = new BizClient(url); this._biz.on('join-reply', async (success: boolean, reason: string) => { - if (this.onjoin) { - this.onjoin(success, reason); - } if (success && !this._sfu) { const signal = new IonSFUGRPCWebSignal(url); const sfu = new Client(signal, config); @@ -104,6 +101,9 @@ export class IonConnector { await sfu.join(this._sid, this._uid); } + if (this.onjoin) { + this.onjoin(success, reason); + } }); this._biz.on('leave-reply', (reason: string) => {