41 lines
1.1 KiB
HTML
41 lines
1.1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset='UTF-8'>";
|
|
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
|
|
<title>Logic Analyzer</title>
|
|
</head>
|
|
<body>
|
|
<main>
|
|
|
|
</main>
|
|
</body>
|
|
</html>
|
|
|
|
|
|
function connectWebSocket() {
|
|
ws = new WebSocket('ws://' + window.location.hostname + ':81');
|
|
|
|
ws.onopen = function() {
|
|
console.log('WebSocket connected');
|
|
updateStatus('Подключено');
|
|
};
|
|
|
|
ws.onmessage = function(event) {
|
|
const data = JSON.parse(event.data);
|
|
if (data.type === 'data') {
|
|
currentData = data.channels;
|
|
currentSamples = data.samples;
|
|
drawAllWaveforms();
|
|
} else if (data.type === 'status') {
|
|
updateStatus(data.message);
|
|
}
|
|
};
|
|
|
|
ws.onclose = function() {
|
|
console.log('WebSocket disconnected');
|
|
updateStatus('Отключено. Переподключение...');
|
|
setTimeout(connectWebSocket, 1000);
|
|
};
|
|
}
|