mirror of
https://github.com/MercuryWorkshop/adrift.git
synced 2025-05-13 06:10:01 -04:00
handle RTC ArrayBuffers with explicit check
This commit is contained in:
parent
ae6c3061fa
commit
afe01cce3c
1 changed files with 4 additions and 0 deletions
|
@ -111,8 +111,12 @@ async function answerRtc(data: any, onrespond: (answer: any) => void) {
|
|||
};
|
||||
dataChannel.onmessage = (event) => {
|
||||
console.log("messaged");
|
||||
if (event.data instanceof ArrayBuffer) {
|
||||
server.onMsg(event.data);
|
||||
}
|
||||
if (event.data instanceof Buffer) {
|
||||
server.onMsg(bufferToArrayBuffer(event.data));
|
||||
return;
|
||||
}
|
||||
throw new Error("Unexpected datachannel message type");
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue