This commit is contained in:
Cay 2026-03-12 10:49:24 +00:00
parent 6273117779
commit d3508c0b81
2 changed files with 7 additions and 3 deletions

8
app.js
View File

@ -131,8 +131,12 @@ io.on("connection", (socket) => {
console.log("Spieler verbunden");
socket.on("register", (username) => {
socket.user = username;
onlineUsers[username] = socket.id;
const name = String(username);
socket.user = name;
onlineUsers[name] = socket.id;
io.emit("onlineUsers", Object.keys(onlineUsers));
});

View File

@ -1,5 +1,5 @@
const socket = io();
socket.emit("register", window.playerName);
socket.emit("register", String(window.playerName));
const chatTitle = document.getElementById("chat-title");
let channel = "global";