Skip to content

Commit bc5aaec

Browse files
committed
fix: do not copy data when sending
Just pass Uint8Arrays in
1 parent 844e1dd commit bc5aaec

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/polyfill/RTCDataChannel.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ export default class RTCDataChannel extends EventTarget implements globalThis.RT
180180
this.#dataChannel.sendMessageBinary(new Uint8Array(ab));
181181
}
182182
});
183+
} else if (data instanceof Uint8Array) {
184+
this.#dataChannel.sendMessageBinary(data);
183185
} else {
184186
if (process?.versions?.bun) {
185187
this.#dataChannel.sendMessageBinary(Buffer.from(data));

0 commit comments

Comments
 (0)