feat(webui): initial websocket integration to be more responsive #2221

Merged
Sainan merged 4 commits from ws into main 2025-06-20 14:00:57 -07:00
Showing only changes of commit 799e76bdc7 - Show all commits

View File

@ -1,9 +1,9 @@
function openWebSocket() {
window.ws = new WebSocket("/custom/ws");
window.ws.onmessage = (e) => {
window.ws.onmessage = e => {
const msg = JSON.parse(e.data);
if ("ports" in msg) {
location.port = (location.protocol == "https:" ? msg.ports.https : msg.ports.http);
location.port = location.protocol == "https:" ? msg.ports.https : msg.ports.http;
}
if ("config_reloaded" in msg) {
//window.is_admin = undefined;
@ -12,7 +12,7 @@ function openWebSocket() {
}
}
};
window.ws.onclose = function() {
window.ws.onclose = function () {
setTimeout(openWebSocket, 3000);
};
}