summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/tests/unit/websocket_test.ts1
-rw-r--r--ext/websocket/01_websocket.js6
2 files changed, 6 insertions, 1 deletions
diff --git a/cli/tests/unit/websocket_test.ts b/cli/tests/unit/websocket_test.ts
index 7f9f26a35..47d056492 100644
--- a/cli/tests/unit/websocket_test.ts
+++ b/cli/tests/unit/websocket_test.ts
@@ -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();
diff --git a/ext/websocket/01_websocket.js b/ext/websocket/01_websocket.js
index f28e3ef1b..57689d1ae 100644
--- a/ext/websocket/01_websocket.js
+++ b/ext/websocket/01_websocket.js
@@ -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;