This commit is contained in:
yumoqing 2024-10-09 15:09:00 +08:00
parent 483b2e8e43
commit fcf2eb982e

View File

@ -20,7 +20,6 @@ bricks.Signaling = class {
{ {
signaling_url: signaling_url:
info: info:
multiple:false
connect_opts: connect_opts:
} }
*/ */
@ -80,6 +79,7 @@ bricks.Signaling = class {
if (data.type == 'login'){ if (data.type == 'login'){
this.peers[data.msgfrom.id] = data.msgfrom; this.peers[data.msgfrom.id] = data.msgfrom;
return; return;
}
if (data.type == 'logout'){ if (data.type == 'logout'){
var peers = {}; var peers = {};
Object.keys(this.peers).forEach(k =>{ Object.keys(this.peers).forEach(k =>{
@ -294,20 +294,20 @@ bricks.RTCP2PConnect = class {
async def datachannel_message(peer, msg){ async def datachannel_message(peer, msg){
var dc = this.peers[peer.id].dc; var dc = this.peers[peer.id].dc;
if (this.on_dc_messaage){ if (this.opts.on_dc_messaage){
await this.on_dc_message(dc, msg); await this.opts.on_dc_message(dc, msg);
} }
} }
async def datachannel_open(peer){ async def datachannel_open(peer){
var dc = this.peers[peer.id].dc var dc = this.peers[peer.id].dc
if (this.on_dc_open){ if (this.opts.on_dc_open){
await this.on_dc_open(dc); await this.opts.on_dc_open(dc);
} }
} }
async def datachannel_close(peer){ async def datachannel_close(peer){
var dc = this.peers[peer.id].dc var dc = this.peers[peer.id].dc
if (this.on_dc_close){ if (this.opts.on_dc_close){
await this.on_dc_close(dc); await this.opts.on_dc_close(dc);
} }
} }
async createPeerConnection(peer){ async createPeerConnection(peer){