import { logInfo } from "./logger.js"; export class SseService { clients = new Map(); addClient(client) { this.clients.set(client.id, client); logInfo(`SSE client connected: ${client.id}. Total clients: ${this.clients.size}`); } removeClient(clientId) { this.clients.delete(clientId); logInfo(`SSE client disconnected: ${clientId}. Total clients: ${this.clients.size}`); } notifyClients(event) { for (const client of this.clients.values()) { client.send(event); } } getClientCount() { return this.clients.size; } }