From 938b6fa850c15e5b137e6f8ac1ade9b9c2bf33fa Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 9 Oct 2024 19:37:38 +0800 Subject: [PATCH] bugfix --- bricks/rtc.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bricks/rtc.js b/bricks/rtc.js index 70607c0..b226ffd 100644 --- a/bricks/rtc.js +++ b/bricks/rtc.js @@ -77,11 +77,16 @@ bricks.Signaling = class { this.sessionhandlers[sessiontype] = handler; } async recvdata_handler(data){ - if (data.type == 'login'){ - this.peers[data.msgfrom.id] = data.msgfrom; + if (data.type == 'online'){ + data.online.forEach(p => { + var d = self.peers[p.id]; + if (!d) d = {}; + d = bricks.extend(d, p); + self.peers[p.id] = d; + }) return; } - if (data.type == 'logout'){ + if (data.type == 'new_session'){ var peers = {}; Object.keys(this.peers).forEach(k =>{ if (k != data.msgfrom.id){