Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek FiĊĦera <mara@neptuo.com>2022-05-30 13:25:35 +0300
committerGitHub <noreply@github.com>2022-05-30 13:25:35 +0300
commit9380113a892ec86d147e6e7506a10eda407a82be (patch)
tree02988f7b3660dfe5a831820aeb0b5632d890e435 /src/mono/wasm/runtime
parent486b4d1a36aef5bbe6a77bb2c3412772e712961e (diff)
[wasm] Process WebSocket connection errors on NodeJS (#69858)
Diffstat (limited to 'src/mono/wasm/runtime')
-rw-r--r--src/mono/wasm/runtime/web-socket.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mono/wasm/runtime/web-socket.ts b/src/mono/wasm/runtime/web-socket.ts
index a9c42801684..5f2bbbe43d3 100644
--- a/src/mono/wasm/runtime/web-socket.ts
+++ b/src/mono/wasm/runtime/web-socket.ts
@@ -88,10 +88,13 @@ export function mono_wasm_web_socket_open_ref(uri_address: MonoObjectRef, subPro
receive_promise_control.resolve(null);
});
};
+ const local_on_error = (ev: any) => {
+ open_promise_control.reject(ev.message);
+ };
ws.addEventListener("message", local_on_message);
ws.addEventListener("open", local_on_open, { once: true });
ws.addEventListener("close", local_on_close, { once: true });
-
+ ws.addEventListener("error", local_on_error, { once: true });
const ws_js_handle = mono_wasm_get_js_handle(ws);
Module.setValue(web_socket_js_handle, <any>ws_js_handle, "i32");