You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Allow WebSocket connect with no sub-protocols.
This commit is contained in:
@@ -62,25 +62,23 @@ EMSCRIPTEN_KEEPALIVE void _esws_on_close(void *obj, int code, char *reason, int
|
||||
|
||||
Error EMWSClient::connect_to_host(String p_host, String p_path, uint16_t p_port, bool p_ssl, PoolVector<String> p_protocols) {
|
||||
|
||||
String proto_string = p_protocols.join(",");
|
||||
String str = "ws://";
|
||||
String proto_string = "";
|
||||
|
||||
if (p_ssl)
|
||||
str = "wss://";
|
||||
str += p_host + ":" + itos(p_port) + p_path;
|
||||
for (int i = 0; i < p_protocols.size(); i++) {
|
||||
proto_string += p_protocols[i];
|
||||
proto_string += ",";
|
||||
}
|
||||
if (proto_string == "")
|
||||
proto_string = "binary,";
|
||||
|
||||
proto_string = proto_string.substr(0, proto_string.length() - 1);
|
||||
|
||||
_is_connecting = true;
|
||||
/* clang-format off */
|
||||
int peer_sock = EM_ASM_INT({
|
||||
var socket = new WebSocket(UTF8ToString($1), UTF8ToString($2).split(","));
|
||||
var proto_str = UTF8ToString($2);
|
||||
var socket = null;
|
||||
if (proto_str) {
|
||||
socket = new WebSocket(UTF8ToString($1), proto_str.split(","));
|
||||
} else {
|
||||
socket = new WebSocket(UTF8ToString($1));
|
||||
}
|
||||
var c_ptr = Module.IDHandler.get($0);
|
||||
socket.binaryType = "arraybuffer";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user