private static void SetupSignalR(IKernel kernel, IAppBuilder app) { var resolver = new NinjectSignalRDependencyResolver(kernel); var connectionManager = resolver.Resolve<IConnectionManager>(); var heartbeat = resolver.Resolve<ITransportHeartbeat>(); var hubPipeline = resolver.Resolve<IHubPipeline>(); kernel.Bind<IConnectionManager>() .ToConstant(connectionManager); var config = new HubConfiguration { Resolver = resolver }; hubPipeline.AddModule(kernel.Get<LoggingHubPipelineModule>()); app.MapSignalR(config); var monitor = new PresenceMonitor(kernel, connectionManager, heartbeat); monitor.Start(); }
private static void SetupSignalR(IJabbrConfiguration jabbrConfig, IKernel kernel, IAppBuilder app) { var resolver = new NinjectSignalRDependencyResolver(kernel); var connectionManager = resolver.Resolve<IConnectionManager>(); var heartbeat = resolver.Resolve<ITransportHeartbeat>(); var hubPipeline = resolver.Resolve<IHubPipeline>(); var configuration = resolver.Resolve<IConfigurationManager>(); // Enable service bus scale out if (!String.IsNullOrEmpty(jabbrConfig.ServiceBusConnectionString) && !String.IsNullOrEmpty(jabbrConfig.ServiceBusTopicPrefix)) { var sbConfig = new ServiceBusScaleoutConfiguration(jabbrConfig.ServiceBusConnectionString, jabbrConfig.ServiceBusTopicPrefix) { TopicCount = 5 }; resolver.UseServiceBus(sbConfig); } if (jabbrConfig.ScaleOutSqlServer) { resolver.UseSqlServer(ConfigurationManager.ConnectionStrings["Jabbr"].ConnectionString); } kernel.Bind<IConnectionManager>() .ToConstant(connectionManager); // We need to extend this since the inital connect might take a while configuration.TransportConnectTimeout = TimeSpan.FromSeconds(30); var config = new HubConfiguration { Resolver = resolver }; hubPipeline.AddModule(kernel.Get<LoggingHubPipelineModule>()); app.MapSignalR(config); var monitor = new PresenceMonitor(kernel, connectionManager, heartbeat); monitor.Start(); }
private static void SetupSignalR(IKernel kernel, IAppBuilder app) { var resolver = new NinjectSignalRDependencyResolver(kernel); var connectionManager = resolver.Resolve<IConnectionManager>(); var heartbeat = resolver.Resolve<ITransportHeartbeat>(); var hubPipeline = resolver.Resolve<IHubPipeline>(); // Ah well loading system web. kernel.Bind<IProtectedData>() .To<MachineKeyProtectedData>(); kernel.Bind<IConnectionManager>() .ToConstant(connectionManager); var config = new HubConfiguration { Resolver = resolver, EnableDetailedErrors = true }; hubPipeline.AddModule(kernel.Get<LoggingHubPipelineModule>()); app.MapHubs(config); var monitor = new PresenceMonitor(kernel, connectionManager, heartbeat); monitor.Start(); }