n for the WebSocket connection to close
        ws.onclose = () => {
          // Change the LED status to 'off'
          sled.classList.remove("led-on");
          sled.classList.add("led-off");
  
          // Display a disconnected message
          const statusMsg = document.getElementById("status-msg");
          statusMsg.textContent = "Disconnected from server.";
        };
      } catch (error) {
        console.error(error);
      }
    });
  
  // Add a click event listener to the 'send' button
 