public override async Task OnConnectedAsync() { Console.WriteLine($"[S] User {Context.ConnectionId} connected"); if (_users.ContainsKey(Context.UserIdentifier) && !Context.Items.ContainsKey("IsAdded")) { Console.WriteLine($"User {Context.UserIdentifier} already connect"); await Clients.Caller.SendAsync("SessionError", "User with this id already connected"); return; } _users.Add(Context.UserIdentifier, Context); await Clients.Caller.SendAsync("Notify", $"Connected ConnectionId: {Context.ConnectionId} UserId: {Context.UserIdentifier}"); await base.OnConnectedAsync(); }