public override async Task OnConnectedAsync() { var me = Context.User.Identity.Name; _logger.Trace($"User {me} connected. "); var groups = await _groups.GetUsersGroups(me, 0, await _groups.GetUsersGroupsLength(me)); var user = await _users.Get(me); _logger.Trace($"User {user.Login} found. Connection id: {Context.ConnectionId}"); user.ConnectionId = Context.ConnectionId; await _users.Update(user); foreach (var @group in groups) { await Groups.AddToGroupAsync(Context.ConnectionId, @group.GroupGuid); } await base.OnConnectedAsync(); }