From cc7b949a818664d29874a6ff168378aba448adae Mon Sep 17 00:00:00 2001 From: Basoro Date: Thu, 10 Oct 2024 10:51:37 +0800 Subject: [PATCH] Update --- themes/admin/index.html | 3 +++ themes/admin/js/websocket.js | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/themes/admin/index.html b/themes/admin/index.html index d2025b90..f052dcd2 100644 --- a/themes/admin/index.html +++ b/themes/admin/index.html @@ -133,6 +133,9 @@ {loop: $mlite.header}{$value}{/loop} {if: $mlite.websocket == 'ya'} + {/if} diff --git a/themes/admin/js/websocket.js b/themes/admin/js/websocket.js index 9c7b7d03..f26d34c2 100644 --- a/themes/admin/js/websocket.js +++ b/themes/admin/js/websocket.js @@ -1,5 +1,5 @@ -let URL_WEBSOCKET = "ws://localhost:3892"; -let ws = new WebSocket(URL_WEBSOCKET); +// let URL_WEBSOCKET = "ws://localhost:3892"; +var ws = new WebSocket(URL_WEBSOCKET); var baseURL = mlite.url + '/' + mlite.admin; ws.onmessage = function(response){ @@ -18,7 +18,7 @@ ws.onmessage = function(response){ ws.onclose = function(){ // Jika terputus dari websocket server, maka mencoba terhubung kembali. - let interval_reconnect_ws = setInterval(function(){ + var interval_reconnect_ws = setInterval(function(){ if(ws.readyState != 0){ if(ws.readyState == 1){ // readyState = 1 (Open) , berarti sudah terhubung dengan websocket. Maka gak perlu interval lagi. clearInterval(interval_reconnect_ws);