Updated history approach.

This commit is contained in:
2026-02-14 22:43:42 -05:00
parent fddd499398
commit 9985473ceb
2 changed files with 20 additions and 32 deletions

View File

@@ -56,19 +56,6 @@ export function initWebSocket(username, chatEl, inputContainer, usersListEl) {
users.forEach(({ id, username }) => addUser(id, username));
const groups = getGroupedUsers();
usersListEl.innerHTML = "Online: " + groups.join(", ");
// Replay chat history.
const history = packet.data.history || [];
history.forEach((raw) => {
try {
const histPkt = JSON.parse(raw);
if (histPkt.type === "msg-event") {
const { id, username: u, content, ts, parent } = histPkt.data;
addMessage({ id, username: u, content, ts, parent });
}
} catch (e) {
console.error("Invalid history entry", raw);
}
});
//addNotice(`<i>Users online: ${groups.join(", ")}</i>`);
break;
}