  statusMsg.textContent = "Connected successfully to port:", websocketPort;
  
        // Listen for incoming messages from the server
        ws.onmessage = handleServerMessage;
  
        // Listen 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("statu