private AuthResponse <T> Authenticate <T>(string token, Func <T> callback) { AuthState authState = _WebServer.CheckAuth(Context.ConnectionId, token); if (authState == AuthState.Authenticated) { Groups.Add(Context.ConnectionId, GROUP_AUTHED); return(AuthResponse <T> .Authenticated(callback.Invoke())); } Groups.Remove(Context.ConnectionId, GROUP_AUTHED); return(AuthResponse <T> .NotAuthenticated(authState)); }