WebRTC Base

This commit is contained in:
Abdussamed 2023-04-22 12:31:04 +03:00
parent 17eacfcfdc
commit 5360929167
3 changed files with 14 additions and 12 deletions

View File

@ -206,8 +206,7 @@ export default class WebRTC
{
if(event.channel.label == ':default:'){
WebRTC.channels.set(this.id, this);
this.channel = event.channel
}
this.channel = event.channel;
event.channel.addEventListener("message",({data})=>{
let pack = JSON.parse(data);
this.emit('input', pack);
@ -217,6 +216,9 @@ export default class WebRTC
WebRTC.channels.delete(this.id);
WebRTC.requireGC = true;
})
}else{
this.emit('datachannel', event.channel);
}
}
public send(data:object)
{

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long