feat(webui): initial websocket integration to be more responsive #2221
@ -1,16 +1,22 @@
|
||||
window.ws = new WebSocket("/custom/ws");
|
||||
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);
|
||||
}
|
||||
if ("config_reloaded" in msg) {
|
||||
//window.is_admin = undefined;
|
||||
if (single.getCurrentPath() == "/webui/cheats") {
|
||||
single.loadRoute("/webui/cheats");
|
||||
function openWebSocket() {
|
||||
window.ws = new WebSocket("/custom/ws");
|
||||
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);
|
||||
}
|
||||
}
|
||||
};
|
||||
if ("config_reloaded" in msg) {
|
||||
//window.is_admin = undefined;
|
||||
if (single.getCurrentPath() == "/webui/cheats") {
|
||||
single.loadRoute("/webui/cheats");
|
||||
}
|
||||
}
|
||||
};
|
||||
window.ws.onclose = function() {
|
||||
setTimeout(openWebSocket, 3000);
|
||||
};
|
||||
}
|
||||
openWebSocket();
|
||||
|
||||
let loginOrRegisterPending = false;
|
||||
window.registerSubmit = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user