Implement WebSocket clean close detection.

This commit is contained in:
Fabio Alessandrelli 2018-09-24 00:58:28 +02:00
parent 5d91e87c64
commit 4b92956db7
10 changed files with 20 additions and 13 deletions

View file

@ -57,7 +57,7 @@ EMSCRIPTEN_KEEPALIVE void _esws_on_close(void *obj, int code, char *reason, int
EMWSClient *client = static_cast<EMWSClient *>(obj);
client->_on_close_request(code, String(reason));
client->_is_connecting = false;
client->_on_disconnect();
client->_on_disconnect(was_clean != 0);
}
}
@ -146,7 +146,7 @@ Error EMWSClient::connect_to_host(String p_host, String p_path, uint16_t p_port,
if (!Module.IDHandler.has($0))
return; // Godot Object is gone!
var was_clean = 0;
if (event.was_clean)
if (event.wasClean)
was_clean = 1;
ccall("_esws_on_close",
"void",