mirror of
https://github.com/denoland/deno.git
synced 2024-12-24 08:09:08 -05:00
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:
parent
642c4a44a5
commit
8e4feacd25
2 changed files with 6 additions and 1 deletions
|
@ -381,6 +381,7 @@ Deno.test(
|
||||||
assert(typeof socket.url == "string");
|
assert(typeof socket.url == "string");
|
||||||
assert(socket.readyState == WebSocket.OPEN);
|
assert(socket.readyState == WebSocket.OPEN);
|
||||||
assert(socket.protocol == "");
|
assert(socket.protocol == "");
|
||||||
|
assert(socket.binaryType == "arraybuffer");
|
||||||
socket.close();
|
socket.close();
|
||||||
};
|
};
|
||||||
socket.onclose = () => ac.abort();
|
socket.onclose = () => ac.abort();
|
||||||
|
|
|
@ -590,7 +590,11 @@ function createWebSocketBranded() {
|
||||||
socket[_extensions] = "";
|
socket[_extensions] = "";
|
||||||
socket[_protocol] = "";
|
socket[_protocol] = "";
|
||||||
socket[_url] = "";
|
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[_idleTimeoutDuration] = 0;
|
||||||
socket[_idleTimeoutTimeout] = undefined;
|
socket[_idleTimeoutTimeout] = undefined;
|
||||||
return socket;
|
return socket;
|
||||||
|
|
Loading…
Reference in a new issue