s-msg");
          statusMsg.textContent = "Disconnected from server.";
        };
      } catch (error) {
        console.error(error);
      }
    });
  
  // Add a click event listener to the 'send' button
  sendbtn.addEventListener("click", async () => {
    const inputText = inputbox.value;
      chatbox.innerHTML += `<p><strong>User:</strong> ${inputText}</p>`;
      chatbox.scrollTop = chatbox.scrollHeight;
    if (inputText.trim() !== "") {     
      // Send message to the server
   