1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-10 13:00:37 +00:00

Web: Avoid extra copy when encoding string in WebSocket _onmessage

This commit is contained in:
Marcos Casagrande
2025-04-19 17:45:06 +02:00
parent 2d3bdcac35
commit f05b22c53e

View File

@@ -58,8 +58,7 @@ const GodotWebSocket = {
return;
} else if (typeof event.data === 'string') {
is_string = 1;
const enc = new TextEncoder('utf-8');
buffer = new Uint8Array(enc.encode(event.data));
buffer = new TextEncoder('utf-8').encode(event.data);
} else {
GodotRuntime.error('Unknown message type');
return;