This commit is contained in:
yumoqing 2024-08-20 17:41:55 +08:00
parent bb05f80bb2
commit 640dc0d0a3

View File

@ -38,10 +38,10 @@ bricks.RTCClient = class extends bricks.VBox {
this.peerConnection;
this.onlineList= [];
this.socket = new WebSocket(this.signaling_url);
this.socket.onmessage = this.signaling_message_handle.bind(this);
this.socket.onopen = this.signaling_login.bind(this);
this.socket.onclose = null;
this.socket.onerror = null;
this.socket.onmessage = this.signaling_message_handle.bind(this);
}
build_phone(){
var opts = {
@ -77,6 +77,7 @@ bricks.RTCClient = class extends bricks.VBox {
message:'no peer logined'
});
w.open();
return;
}
this.onlineList.forEach( p => {
var m = {
@ -194,7 +195,7 @@ bricks.RTCClient = class extends bricks.VBox {
}
async signaling_message_handle(event){
var d = event.data;
console.log('data received from server', d);
console.log('data received from server', d, event);
switch (d.type){
case 'onlineList':
this.onlineList = d.onlineList;