public async Task Connect(string hostAddress) { var hubConnection = new HubConnection(hostAddress); hubConnection.Headers.Add(Headers.FooidityAppKey, _applicationKey); hubConnection.Error += x => Console.WriteLine(x.Message); hubConnection.ConnectionSlow += () => Console.WriteLine("Connection is slow"); hubConnection.StateChanged += x => Console.WriteLine("state changed from {0} to {1}", x.OldState, x.NewState); hubConnection.Closed += () => Console.WriteLine("connection closed"); hubConnection.Received += x => Console.WriteLine("received: {0}", x); IHubProxy applicationHub = hubConnection.CreateHubProxy("ApplicationHub"); applicationHub.On("notifyMissingAppKey", OnMissingAppKey); applicationHub.On("notifyInvalidAppKey", OnInvalidAppKey); applicationHub.On <CodeFeatureStateUpdated>("notifyCodeFeatureStateUpdated", OnCodeFeatureStateUpdated); await hubConnection.Start(); _hubConnection = hubConnection; _applicationHub = applicationHub; _reporter = new CodeSwitchEvaluationApplicationReporter(_applicationHub); await Task.Run(() => { var cache = new CodeFeatureStateCache(new ApplicationHubProvider(applicationHub)); _cache = cache; _updateCache = cache; }); }
public UpdateCodeFeatureCacheConsumer(IUpdateCodeFeatureCache updateCache) { _updateCache = updateCache; }