summaryrefslogtreecommitdiffstats
path: root/modules/websocket
diff options
context:
space:
mode:
Diffstat (limited to 'modules/websocket')
-rw-r--r--modules/websocket/library_godot_websocket.js7
-rw-r--r--modules/websocket/wsl_peer.cpp4
2 files changed, 8 insertions, 3 deletions
diff --git a/modules/websocket/library_godot_websocket.js b/modules/websocket/library_godot_websocket.js
index ed01c69725..a6ebdeba6a 100644
--- a/modules/websocket/library_godot_websocket.js
+++ b/modules/websocket/library_godot_websocket.js
@@ -124,7 +124,7 @@ const GodotWebSocket = {
const ref = IDHandler.get(p_id);
if (ref && ref.readyState < ref.CLOSING) {
const code = p_code;
- const reason = GodotRuntime.parseString(p_reason);
+ const reason = p_reason;
ref.close(code, reason);
}
},
@@ -144,6 +144,7 @@ const GodotWebSocket = {
},
},
+ godot_js_websocket_create__proxy: 'sync',
godot_js_websocket_create__sig: 'iiiiiiii',
godot_js_websocket_create: function (p_ref, p_url, p_proto, p_on_open, p_on_message, p_on_error, p_on_close) {
const on_open = GodotRuntime.get_func(p_on_open).bind(null, p_ref);
@@ -166,6 +167,7 @@ const GodotWebSocket = {
return GodotWebSocket.create(socket, on_open, on_message, on_error, on_close);
},
+ godot_js_websocket_send__proxy: 'sync',
godot_js_websocket_send__sig: 'iiiii',
godot_js_websocket_send: function (p_id, p_buf, p_buf_len, p_raw) {
const bytes_array = new Uint8Array(p_buf_len);
@@ -180,11 +182,13 @@ const GodotWebSocket = {
return GodotWebSocket.send(p_id, out);
},
+ godot_js_websocket_buffered_amount__proxy: 'sync',
godot_js_websocket_buffered_amount__sig: 'ii',
godot_js_websocket_buffered_amount: function (p_id) {
return GodotWebSocket.bufferedAmount(p_id);
},
+ godot_js_websocket_close__proxy: 'sync',
godot_js_websocket_close__sig: 'viii',
godot_js_websocket_close: function (p_id, p_code, p_reason) {
const code = p_code;
@@ -192,6 +196,7 @@ const GodotWebSocket = {
GodotWebSocket.close(p_id, code, reason);
},
+ godot_js_websocket_destroy__proxy: 'sync',
godot_js_websocket_destroy__sig: 'vi',
godot_js_websocket_destroy: function (p_id) {
GodotWebSocket.destroy(p_id);
diff --git a/modules/websocket/wsl_peer.cpp b/modules/websocket/wsl_peer.cpp
index a127a6b75a..38cb614847 100644
--- a/modules/websocket/wsl_peer.cpp
+++ b/modules/websocket/wsl_peer.cpp
@@ -600,7 +600,7 @@ ssize_t WSLPeer::_wsl_send_callback(wslay_event_context_ptr ctx, const uint8_t *
}
int WSLPeer::_wsl_genmask_callback(wslay_event_context_ptr ctx, uint8_t *buf, size_t len, void *user_data) {
- ERR_FAIL_COND_V(!_static_rng, WSLAY_ERR_CALLBACK_FAILURE);
+ ERR_FAIL_NULL_V(_static_rng, WSLAY_ERR_CALLBACK_FAILURE);
Error err = _static_rng->get_random_bytes(buf, len);
ERR_FAIL_COND_V(err != OK, WSLAY_ERR_CALLBACK_FAILURE);
return 0;
@@ -676,7 +676,7 @@ void WSLPeer::poll() {
}
if (ready_state == STATE_OPEN || ready_state == STATE_CLOSING) {
- ERR_FAIL_COND(!wsl_ctx);
+ ERR_FAIL_NULL(wsl_ctx);
int err = 0;
if ((err = wslay_event_recv(wsl_ctx)) != 0 || (err = wslay_event_send(wsl_ctx)) != 0) {
// Error close.