|
|
@ -13,9 +13,12 @@
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
const socket = io();
|
|
|
|
const socket = io();
|
|
|
|
|
|
|
|
|
|
|
|
// Listen for custom events from the server
|
|
|
|
|
|
|
|
socket.on('node-data', function(data) {
|
|
|
|
socket.on('node-data', function(data) {
|
|
|
|
console.log(data); // Log the received data to the browser's console
|
|
|
|
console.log(data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Split the data into separate parts
|
|
|
|
|
|
|
|
const [node, value] = data.split(' ');
|
|
|
|
|
|
|
|
|
|
|
|
if (node === 'node4' && value === '21') {
|
|
|
|
if (node === 'node4' && value === '21') {
|
|
|
|
// Change the background color to red
|
|
|
|
// Change the background color to red
|
|
|
|
document.body.style.backgroundColor = 'red';
|
|
|
|
document.body.style.backgroundColor = 'red';
|
|
|
|