fix rtctransport bug

This commit is contained in:
CoolElectronics 2023-08-12 18:36:23 -04:00
parent 2f666df2ed
commit db82f47aca
No known key found for this signature in database
GPG key ID: F63593D168636C50

View file

@ -42,10 +42,12 @@ export class RTCTransport extends Transport {
this.peer.onicegatheringstatechange = onicegatheringstatechange; this.peer.onicegatheringstatechange = onicegatheringstatechange;
this.dataChannel = this.peer.createDataChannel("host-server"); this.dataChannel = this.peer.createDataChannel("host-server");
this.dataChannel.onopen = onopen; this.dataChannel.onopen = onopen;
this.dataChannel.binaryType = "arraybuffer";
this.dataChannel.onclose = onclose; this.dataChannel.onclose = onclose;
this.dataChannel.onmessage = async (event) => { this.dataChannel.onmessage = async (event) => {
let buf = await event.data.arrayBuffer(); console.log(event);
let buf = event.data;
this.ondata(buf); this.ondata(buf);
}; };
} }