public async Task AddToGroupWithConditionAsync(string connectionId, string groupName)
        {
            if (State.Members.Count <= 4)
            {
                await _hubProxy.AddToGroupAsync(connectionId, groupName);

                State.Members.Add(connectionId);
            }
        }
Beispiel #2
0
        public async Task SendMessage(string user, string message)
        {
            if (user.StartsWith("A"))
            {
                await _hubProxy.AddToGroupAsync(Context.ConnectionId, "SpecialUsers");
            }

            await Clients.All.SendAsync("ReceiveMessage", user, message);
        }