You've already forked godot
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:
@@ -58,8 +58,7 @@ const GodotWebSocket = {
|
|||||||
return;
|
return;
|
||||||
} else if (typeof event.data === 'string') {
|
} else if (typeof event.data === 'string') {
|
||||||
is_string = 1;
|
is_string = 1;
|
||||||
const enc = new TextEncoder('utf-8');
|
buffer = new TextEncoder('utf-8').encode(event.data);
|
||||||
buffer = new Uint8Array(enc.encode(event.data));
|
|
||||||
} else {
|
} else {
|
||||||
GodotRuntime.error('Unknown message type');
|
GodotRuntime.error('Unknown message type');
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user