import { logInfo } from "./logger.js"; export class WsService { clients = new Set(); addClient(ws) { this.clients.add(ws); logInfo(`Socket connected. Total clients: ${this.clients.size}`); } removeClient(ws) { this.clients.delete(ws); logInfo(`Socket disconnected. Total clients: ${this.clients.size}`); } broadcast(message) { this.clients.forEach((socket) => { socket.send(JSON.stringify(message)); }); } getClientCount() { return this.clients.size; } }