You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.3 KiB
39 lines
1.3 KiB
<!-- templates/network.html -->
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Network Connection Status</title>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.min.js"></script>
|
|
<style>
|
|
body { font-family: Arial, sans-serif; }
|
|
#network { padding: 20px; }
|
|
.client {
|
|
color: white;
|
|
padding: 10px;
|
|
margin: 5px;
|
|
border-radius: 5px;
|
|
}
|
|
.connected { background-color: green; }
|
|
.disconnected { background-color: red; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>Client Connection Status</h1>
|
|
<div id="network"></div>
|
|
<script>
|
|
const socket = io('http://localhost:3000');
|
|
const networkElement = document.getElementById('network');
|
|
|
|
socket.on('clients_status', (clients) => {
|
|
networkElement.innerHTML = '';
|
|
for (const [id, info] of Object.entries(clients)) {
|
|
const clientElement = document.createElement('div');
|
|
clientElement.className = 'client ' + info.status;
|
|
clientElement.textContent = `Client ID: ${id} - Status: ${info.status}`;
|
|
networkElement.appendChild(clientElement);
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |