Attempted fix for the selfhosted webclient.

This commit is contained in:
Charles Descamps 2025-03-27 18:30:18 -07:00
parent 44cdbde003
commit 0fd8ce7788

View file

@ -6,33 +6,11 @@
<title>Web Chat Client</title>
<script src="https://cdn.socket.io/4.5.0/socket.io.min.js"></script>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
height: 100vh;
}
#chat {
flex: 1;
overflow-y: auto;
padding: 10px;
border-bottom: 1px solid #ccc;
}
#messageInput {
display: flex;
padding: 10px;
}
#messageInput input {
flex: 1;
padding: 10px;
font-size: 16px;
}
#messageInput button {
padding: 10px;
font-size: 16px;
}
body { font-family: Arial, sans-serif; margin: 0; padding: 0; display: flex; flex-direction: column; height: 100vh; }
#chat { flex: 1; overflow-y: auto; padding: 10px; border-bottom: 1px solid #ccc; }
#messageInput { display: flex; padding: 10px; }
#messageInput input { flex: 1; padding: 10px; font-size: 16px; }
#messageInput button { padding: 10px; font-size: 16px; }
</style>
</head>
<body>
@ -50,9 +28,8 @@
let username = prompt("Enter your username:");
let chatRoom = prompt("Enter chat room (default: 'default')") || 'default';
// Log the join event data
console.log('Joining chat room:', { username: username, chat_room: chatRoom });
// Join the chat room
console.log('Joining chat room:', { username: username, chat_room: chatRoom });
socket.emit('join', { username: username, chat_room: chatRoom });
// Listen for messages from the server
@ -67,17 +44,11 @@
function sendMessage() {
const message = messageInput.value;
if (message.trim() !== '') {
// Log the send_message event data
console.log('Sending message:', { username: username, chat_room: chatRoom, message: message });
socket.emit('send_message', { username: username, chat_room: chatRoom, message: message });
messageInput.value = ''; // Clear the input field
}
}
// Log the send_message event data
console.log('Sending message:', { username: username, chat_room: chatRoom, message: message });
// Send a message to the server
socket.emit('send_message', { username: username, chat_room: chatRoom, message: message });
</script>
</body>
</html>