ваше сообщение коммита

This commit is contained in:
2025-07-16 17:25:58 +03:00
parent d952e89a26
commit 32acc60360
27 changed files with 539 additions and 138 deletions

View File

@@ -27,4 +27,12 @@ function broadcastMessagesUpdate() {
}
}
module.exports = { initWSS, broadcastContactsUpdate, broadcastMessagesUpdate };
function broadcastChatMessage(message) {
for (const ws of wsClients) {
if (ws.readyState === WebSocket.OPEN) {
ws.send(JSON.stringify({ type: 'chat-message', message }));
}
}
}
module.exports = { initWSS, broadcastContactsUpdate, broadcastMessagesUpdate, broadcastChatMessage };