public override async Task OnConnectedAsync() { if (Context?.User?.Identity?.Name != null) { var user = _userService.SearchUserByEmail(Context.User.Identity.Name).FirstOrDefault(); if (user != null) { _userConnectionService.SaveUserConnection(user.Id, Context.ConnectionId); await this.GetChatRooms(user.Id); } } await this.CreateGroupsForCurrentRooms(); await base.OnConnectedAsync(); }