fix(ext/http): use arraybuffer binaryType for server websocket (#21741)

Ref
https://github.com/denoland/deno/issues/15340#issuecomment-1872353134
This commit is contained in:
Divy Srivastava 2024-01-02 10:30:09 +05:30 committed by GitHub
parent 642c4a44a5
commit 8e4feacd25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -381,6 +381,7 @@ Deno.test(
assert(typeof socket.url == "string");
assert(socket.readyState == WebSocket.OPEN);
assert(socket.protocol == "");
assert(socket.binaryType == "arraybuffer");
socket.close();
};
socket.onclose = () => ac.abort();

View file

@ -590,7 +590,11 @@ function createWebSocketBranded() {
socket[_extensions] = "";
socket[_protocol] = "";
socket[_url] = "";
socket[_binaryType] = "blob";
// We use ArrayBuffer for server websockets for backwards compatibility
// and performance reasons.
//
// https://github.com/denoland/deno/issues/15340#issuecomment-1872353134
socket[_binaryType] = "arraybuffer";
socket[_idleTimeoutDuration] = 0;
socket[_idleTimeoutTimeout] = undefined;
return socket;