bugfix
This commit is contained in:
parent
79154df9fb
commit
7d5a13850d
@ -335,7 +335,7 @@ bricks.RTCP2PConnect = class {
|
|||||||
this.opts.data_connect,
|
this.opts.data_connect,
|
||||||
'role=', role);
|
'role=', role);
|
||||||
if (role == 'requester'){
|
if (role == 'requester'){
|
||||||
this.peers[peer.id].dc = pc.createDataChannel('chat');
|
this.peers[peer.id].dc = pc.createDataChannel('chat', {ordered:true});
|
||||||
var dc = this.peers[peer.id].dc;
|
var dc = this.peers[peer.id].dc;
|
||||||
await this.dc_created(peer, this.peers[peer.id].dc);
|
await this.dc_created(peer, this.peers[peer.id].dc);
|
||||||
if(this.opts.on_pc_connected){
|
if(this.opts.on_pc_connected){
|
||||||
@ -360,16 +360,17 @@ bricks.RTCP2PConnect = class {
|
|||||||
dc.onclose = this.datachannel_close(peer);
|
dc.onclose = this.datachannel_close(peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
async datachannel_message(peer, msg){
|
async datachannel_message(peer, event){
|
||||||
console.log('datachannel_message():', this, arguments);
|
console.log('datachannel_message():', this, arguments);
|
||||||
var dc = this.peers[peer.id].dc;
|
var dc = this.peers[peer.id].dc;
|
||||||
if (this.opts.on_dc_messaage){
|
if (this.opts.on_dc_messaage){
|
||||||
await this.opts.on_dc_message(dc, msg);
|
await this.opts.on_dc_message(dc, event.data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async datachannel_open(peer){
|
async datachannel_open(peer){
|
||||||
console.log('datachannel_open():', this, arguments);
|
console.log('datachannel_open():', this, arguments);
|
||||||
var dc = this.peers[peer.id].dc
|
var dc = this.peers[peer.id].dc
|
||||||
|
dc.send('test');
|
||||||
if (this.opts.on_dc_open){
|
if (this.opts.on_dc_open){
|
||||||
await this.opts.on_dc_open(dc);
|
await this.opts.on_dc_open(dc);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user