Repository: godot
Issue: [3.5.2.stable] WebSocketClient.connect_to_url() is broken for Web export
Labels: bug,platform:web,topic:network

### Godot version

3.5.2.stable

### System information

Windows 10

### Issue description

Calling a `WebSocketClient.connect_to_url()` will crash with errors regardless of browsers. Only crash for web export, native export (windows) works fine.

Tested on both `localhost` (with link `ws://localhost:80`) and secure connection over `ngrok` (with link `wss://123-abc.ngrok-free.app`, same result.

This error is NOT caught by the `err` response:
```
err = _client.connect_to_url(_uri)
if err != OK:
	set_process(false)
	print("Connection ERROR: ", err)
```

Error log:
```
_godot_js_websocket_create	@	index.js:9
$EMWSClient::connect_to_host(String, String, unsigned short, bool, Vector<String>, Vector<String>)	@	04428bc2:0xb8e8eb
$WebSocketClient::connect_to_url(String, Vector<String>, bool, Vector<String>)	@	04428bc2:0x8e4624
$MethodBind4R<Error, String, Vector<String>, bool, Vector<String>>::call(Object*, Variant const**, int, Variant::CallError&)	@	04428bc2:0xa9b515
$Object::call(StringName const&, Variant const**, int, Variant::CallError&)	@	04428bc2:0x29890e
$Variant::call_ptr(StringName const&, Variant const**, int, Variant*, Variant::CallError&)	@	04428bc2:0x2521c9
$GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Variant::CallError&, GDScriptFunction::CallState*)	@	04428bc2:0xc5c33
$GDScriptInstance::call(StringName const&, Variant const**, int, Variant::CallError&)	@	04428bc2:0xb82044
$Object::call(StringName const&, Variant const**, int, Variant::CallError&)	@	04428bc2:0x298875
$Variant::call_ptr(StringName const&, Variant const**, int, Variant*, Variant::CallError&)	@	04428bc2:0x2521c9
$GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Variant::CallError&, GDScriptFunction::CallState*)	@	04428bc2:0xc5c49
$GDScriptInstance::_ml_call_reversed(GDScript*, StringName const&, Variant const**, int)	@	04428bc2:0x661a72
$GDScriptInstance::call_multilevel_reversed(StringName const&, Variant const**, int)	@	04428bc2:0xb81f78
$Node::_notificationv(int, bool)	@	04428bc2:0x5e411
$CanvasItem::_notificationv(int, bool)	@	04428bc2:0x204944
$Node2D::_notificationv(int, bool)	@	04428bc2:0x42cb8
$Object::notification(int, bool)	@	04428bc2:0x3fff1
$Node::_propagate_ready()	@	04428bc2:0x597831
$Node::_set_tree(SceneTree*)	@	04428bc2:0x183540
$Node::_add_child_nocheck(Node*, StringName const&)	@	04428bc2:0x5988da
$Node::add_child(Node*, bool)	@	04428bc2:0x348b3
$SceneTree::_change_scene(Node*)	@	04428bc2:0x99691f
$MethodBind1<Node*>::call(Object*, Variant const**, int, Variant::CallError&)	@	04428bc2:0xb3369e
$Object::call(StringName const&, Variant const**, int, Variant::CallError&)	@	04428bc2:0x29890e
$MessageQueue::flush()	@	04428bc2:0xf9596
$SceneTree::iteration(float)	@	04428bc2:0x994dd8
$main_loop_callback()	@	04428bc2:0x37b882
callUserCallback	@	index.js:9
runIter	@	index.js:9
Browser_mainLoop_runner
```

### Steps to reproduce

Minimal reproduction project includes a very simple websocket project. Run server first then client, if it works properly, then it should have printed a message in console for the server.

Export to both web (only for client) and native to test.

### Minimal reproduction project

[Repo.zip](https://github.com/godotengine/godot/files/12475863/Repo.zip)