This commit is contained in:
yumoqing 2024-10-09 19:37:38 +08:00
parent bc1b52d5de
commit 938b6fa850

View File

@ -77,11 +77,16 @@ bricks.Signaling = class {
this.sessionhandlers[sessiontype] = handler; this.sessionhandlers[sessiontype] = handler;
} }
async recvdata_handler(data){ async recvdata_handler(data){
if (data.type == 'login'){ if (data.type == 'online'){
this.peers[data.msgfrom.id] = data.msgfrom; data.online.forEach(p => {
var d = self.peers[p.id];
if (!d) d = {};
d = bricks.extend(d, p);
self.peers[p.id] = d;
})
return; return;
} }
if (data.type == 'logout'){ if (data.type == 'new_session'){
var peers = {}; var peers = {};
Object.keys(this.peers).forEach(k =>{ Object.keys(this.peers).forEach(k =>{
if (k != data.msgfrom.id){ if (k != data.msgfrom.id){