e}</p>`;
            };
        });

        disconnectBtn.addEventListener('click', () => {
            socket.close();
        });

        sendBtn.addEventListener('click', () => {
            const message = messageInput.value;
            socket.send(message);
            output.innerHTML += `<p>Sent: ${message}</p>`;
            messageInput.value = '';
        });
    </script>
</body>
</html>