v1 review pass: fixed some minor bugs

This commit is contained in:
khannurien
2026-03-16 11:08:39 +00:00
parent e88fed4e98
commit 867e64cb5b
37 changed files with 1228 additions and 400 deletions

View File

@@ -65,15 +65,26 @@ export function broadcastDumpDeleted(dumpId: string): void {
}
}
export function broadcastVoteUpdate(dumpId: string, voteCount: number): void {
export function broadcastVoteUpdate(
dumpId: string,
voteCount: number,
voterId: string,
action: "cast" | "remove",
): void {
for (const client of clients) {
send(client.socket, { type: "votes_update", dumpId, voteCount });
send(client.socket, {
type: "votes_update",
dumpId,
voteCount,
voterId,
action,
});
}
}
// Keepalive: ping all clients every 30s, remove non-responsive ones
const PING_INTERVAL = 30_000;
const PONG_TIMEOUT = 5_000;
const _PONG_TIMEOUT = 5_000;
setInterval(() => {
for (const client of clients) {