public static void Start() { GlobalHost.DependencyResolver.Register(typeof(IHubActivator), () => new UnityHubActivator(UnityConfiguration.GetConfiguredContainer())); GlobalHost.HubPipeline.AddModule(new LoggingPipelineModule()); GlobalHost.HubPipeline.AddModule(new ErrorHandlingPipelineModule()); var url = MyConfiguration.GetInstance().MyHubServiceUrl(); _myHub = UnityConfiguration.GetConfiguredContainer().Resolve <ISendHubSync>(); using (WebApp.Start(url)) { Console.WriteLine("Server running on {0}", url); while (true) { var key = Console.ReadLine(); if (key.ToUpper() == "W") { _myHub.AddMessage("Server", "addmessage sent from server"); } if (key.ToUpper() == "E") { _myHub.Heartbeat(); } if (key.ToUpper() == "R") { _myHub.SendHelloObject(new HelloModel { Age = 37, Molly = "pushed direct from Server " }); } if (key.ToUpper() == "C") { break; } } Console.ReadLine(); } }
public static void Start() { GlobalHost.DependencyResolver.Register(typeof(IHubActivator), () => new UnityHubActivator(UnityConfiguration.GetConfiguredContainer())); GlobalHost.HubPipeline.AddModule(new LoggingPipelineModule()); GlobalHost.HubPipeline.AddModule(new ErrorHandlingPipelineModule()); var url = MyConfiguration.GetInstance().MyHubServiceUrl(); _myHub = UnityConfiguration.GetConfiguredContainer().Resolve<ISendHubSync>(); using (WebApp.Start(url)) { Console.WriteLine("Server running on {0}", url); while (true) { var key = Console.ReadLine(); if (key.ToUpper() == "W") { _myHub.AddMessage("Server", "addmessage sent from server"); } if (key.ToUpper() == "E") { _myHub.Heartbeat(); } if (key.ToUpper() == "R") { _myHub.SendHelloObject(new HelloModel { Age = 37, Molly = "pushed direct from Server " }); } if (key.ToUpper() == "C") { break; } } Console.ReadLine(); } }