diff --git a/bricks/rtc.js b/bricks/rtc.js index 35c486b..33734cb 100644 --- a/bricks/rtc.js +++ b/bricks/rtc.js @@ -61,12 +61,10 @@ bricks.Signaling = class { this.onclose(); } return; - try { - this.socket.close(); - } catch(e){ - console.log('error,', e); - } - this.init_websocket(); + } + del_handler(sessionid){ + var handlers = {}; + delete self.handlers[sessionid]; } async signaling_recvdata(event){ var datapkg = JSON.parse(event.data); @@ -110,15 +108,6 @@ bricks.Signaling = class { } return; } - if (data.type == 'new_session'){ - var peers = {}; - Object.keys(this.peers).forEach(k =>{ - if (k != data.msgfrom.id){ - peers[k] = this.peers[k]; - } - }); - return; - } console.log('recv data=', data, 'NOT HANDLED'); } new_session(sessiontype, peer){ @@ -467,6 +456,7 @@ bricks.RTCP2PConnect = class { .getTracks().forEach(track => track.stop()); this.local_stream.getTracks().forEach(track => track.stop()); this.local_screan.getTracks().forEach(track => track.stop()); + this.signaling.del_handler(this.session.sessionid); } } };