Групповые звонки

This commit is contained in:
Халимов Рустам
2026-03-14 23:27:55 +03:00
parent be0a50b702
commit 3b990f8619
10 changed files with 443 additions and 39 deletions
@@ -363,6 +363,7 @@ public sealed class ChatHub : Hub
var userInfo = new ParticipantInfo(userId, username, displayName, avatar);
var participants = _groupCallParticipants.GetOrAdd(chatId, _ => new ConcurrentDictionary<string, ParticipantInfo>());
var isFirst = participants.IsEmpty;
participants.TryAdd(userId, userInfo);
// Notify others
@@ -380,6 +381,17 @@ public sealed class ChatHub : Hub
chatId = chatId,
participants = others
});
if (isFirst)
{
await Clients.Group(chatId).SendAsync("group_call_incoming", new
{
chatId = chatId,
from = userId,
callerInfo = userInfo,
callType = request.CallType
});
}
}
[HubMethodName("group_call_leave")]
@@ -393,6 +405,7 @@ public sealed class ChatHub : Hub
if (participants.IsEmpty)
{
_groupCallParticipants.TryRemove(chatId, out _);
await Clients.Group(chatId).SendAsync("group_call_ended", new { chatId = chatId });
}
}