Commit 06/08/2025

This commit is contained in:
2025-08-06 09:29:14 +07:00
parent 8290418100
commit 158f3ea4c2
12 changed files with 345 additions and 23 deletions

View File

@@ -9,7 +9,7 @@ $(document).ready(function() {
$('#indicatorDisconnected').addClass('visually-hidden');
$('#indicatorConnected').removeClass('visually-hidden');
setInterval(function() {
ws.send(JSON.stringify({ command: "getZelloStatus" }));
sendCommand({ command: "getZelloStatus" });
}, 5000);
};
@@ -39,4 +39,12 @@ $(document).ready(function() {
ws.onerror = function(error) {
console.error('WebSocket error:', error);
};
function sendCommand(command) {
if (ws.readyState === WebSocket.OPEN) {
ws.send(JSON.stringify(command));
} else {
console.error('WebSocket is not open. Unable to send command:', command);
}
}
});