fix: browser returns a Blob, so convert to a buffer if we have a blob
This commit is contained in:
parent
8b7ffa8821
commit
80dd92ddb1
|
@ -24,7 +24,13 @@ export class WebSocketPeer extends BasePeer implements Peer {
|
||||||
this._socket.addEventListener(
|
this._socket.addEventListener(
|
||||||
"message",
|
"message",
|
||||||
async (event: MessageEvent<any>) => {
|
async (event: MessageEvent<any>) => {
|
||||||
await callback(event.data);
|
let data = event.data;
|
||||||
|
|
||||||
|
if (data instanceof Blob) {
|
||||||
|
data = Buffer.from(await data.arrayBuffer());
|
||||||
|
}
|
||||||
|
|
||||||
|
await callback(data);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue