v2: global player, infinite scroll, image picker, threaded comments
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { Dump, OnlineUser, Playlist } from "../model/interfaces.ts";
|
||||
import type { Comment, Dump, OnlineUser, Playlist } from "../model/interfaces.ts";
|
||||
|
||||
export interface WsClient {
|
||||
socket: WebSocket;
|
||||
@@ -59,6 +59,12 @@ export function broadcastNewDump(dump: Dump): void {
|
||||
}
|
||||
}
|
||||
|
||||
export function broadcastDumpUpdated(dump: Dump): void {
|
||||
for (const client of clients) {
|
||||
send(client.socket, { type: "dump_updated", dump });
|
||||
}
|
||||
}
|
||||
|
||||
export function broadcastDumpDeleted(dumpId: string): void {
|
||||
for (const client of clients) {
|
||||
send(client.socket, { type: "dump_deleted", dumpId });
|
||||
@@ -124,6 +130,18 @@ export function broadcastPlaylistDumpsUpdated(
|
||||
});
|
||||
}
|
||||
|
||||
export function broadcastCommentCreated(comment: Comment): void {
|
||||
for (const client of clients) {
|
||||
send(client.socket, { type: "comment_created", comment });
|
||||
}
|
||||
}
|
||||
|
||||
export function broadcastCommentDeleted(commentId: string, dumpId: string): void {
|
||||
for (const client of clients) {
|
||||
send(client.socket, { type: "comment_deleted", commentId, dumpId });
|
||||
}
|
||||
}
|
||||
|
||||
// Keepalive: ping all clients every 30s, remove non-responsive ones
|
||||
const PING_INTERVAL = 30_000;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user