Project homepage Mailing List  Warmcat.com  API Docs  Github Mirror 
    npro  
 Modern all-safe Rust Network Protocol library supporting h1, h2, h3, ws, wt sans-IO and with socket IO + tls
git clone https://npro.rs/repo/npro
 
root / assets / solaris-11.svg
Author[]google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.c...> 2025-08-15 16:13 UTC
Committer[]Andy Green <andy@warmcat.com> 2025-08-15 16:14 UTC
Treef3b8327d371058d0c06f9f0c1208695872c2ca31   Raw Patch
 
Add error and close logging to client-side WebSocket
Add error and close logging to client-side WebSocket

The browser WebSocket connection is repeatedly failing and retrying.
To help diagnose the root cause of the disconnection, this change
adds `onerror` and more detailed `onclose` event handlers to the
client-side JavaScript. This will log any WebSocket errors and close
events to the browser's developer console, providing more information
to debug the issue.
diff --git a/assets/sai.js b/assets/sai.js index b96e4ab..b658494 100644 --- a/assets/sai.js +++ b/assets/sai.js @@ -1594,11 +1594,12 @@ function ws_open_sai() break; } /* switch */ } /* onmessage */ - sai.onclose = function(){ -// document.getElementById("title").innerHTML = -// "Server Status (Disconnected)"; -// lws_gray_out(true,{"zindex":"499"}); - + sai.onerror = function(ev) { + console.log("WebSocket error:", ev); + }; + + sai.onclose = function(ev){ + console.log("WebSocket closed. Code:", ev.code, "Reason:", ev.reason); myVar = setTimeout(ws_open_sai, 4000); }; } catch(exception) {
Page fetched 0s ago, creation time: 3ms (vhost etag hits: 0%, cache hits: 0%)