1
0
Fork 0

Merge pull request #105571 from marcosc90/perf-ws-onmessage

[Web] Avoid extra copy when encoding string in WebSocket `_onmessage`
This commit is contained in:
Thaddeus Crews 2025-06-02 18:51:55 -05:00
commit 760b3522d7
No known key found for this signature in database
GPG Key ID: 8C6E5FEB5FC03CCC
1 changed files with 1 additions and 2 deletions

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;