Commit 06/08/2025
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user