static void Main(string[] args) { var factory = new ConnectionFactory { UserName = "******", Password = "******" }; var exchangeName = "SignalR.RabbitMQ-Example"; var configuration = new RabbitMqScaleoutConfiguration(factory, exchangeName); GlobalHost.DependencyResolver.UseRabbitMq(configuration); ; var hubContext = GlobalHost.ConnectionManager.GetHubContext<Chat>(); Task.Factory.StartNew( () => { while (true) { hubContext.Clients.All.onConsoleMessage("Hello!"); Thread.Sleep(1000); } } ); System.Console.WriteLine("Press any key to exit."); System.Console.Read(); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); var factory = new ConnectionFactory { UserName = "******", Password = "******", HostName = "localhost" }; var exchangeName = "SignalR.RabbitMQ-Example"; var configuration = new RabbitMqScaleoutConfiguration(factory, exchangeName); GlobalHost.DependencyResolver.UseRabbitMq(configuration); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteTable.Routes.MapHubs(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); var factory = new ConnectionFactory { UserName = "******", Password = "******", HostName = "localhost" }; var exchangeName = "SignalR.RabbitMQ-Example"; var configuration = new RabbitMqScaleoutConfiguration(factory, exchangeName); GlobalHost.DependencyResolver.UseRabbitMq(configuration); }
static void Main(string[] args) { var factory = new ConnectionFactory { UserName = "******", Password = "******", HostName = "localhost" }; var exchangeName = "SignalR.RabbitMQ-Example"; var configuration = new RabbitMqScaleoutConfiguration(factory, exchangeName); GlobalHost.DependencyResolver.UseRabbitMq(configuration); var examplePacketSize = 1024 * 2; var hubContext = GlobalHost.ConnectionManager.GetHubContext <Chat>(); Task.Factory.StartNew( () => { int i = 0; while (true) { var message = string.Format("Message Id - {0}, Message Padded To {1} bytes.", i, examplePacketSize); var noise = message.PadRight(examplePacketSize, '-'); hubContext.Clients.All.onConsoleMessage(noise); System.Console.WriteLine(i); i++; Thread.Sleep(100); } } ); System.Console.WriteLine("Press any key to exit."); System.Console.Read(); }
static void Main(string[] args) { var factory = new ConnectionFactory { UserName = "******", Password = "******", HostName = "localhost" }; var exchangeName = "SignalR.RabbitMQ-Example"; var configuration = new RabbitMqScaleoutConfiguration(factory, exchangeName); GlobalHost.DependencyResolver.UseRabbitMq(configuration); var examplePacketSize = 1024*2; var hubContext = GlobalHost.ConnectionManager.GetHubContext<Chat>(); Task.Factory.StartNew( () => { int i = 0; while (true) { var message = string.Format("Message Id - {0}, Message Padded To {1} bytes." , i, examplePacketSize); var noise = message.PadRight(examplePacketSize, '-'); hubContext.Clients.All.onConsoleMessage(noise); System.Console.WriteLine(i); i++; Thread.Sleep(100); } } ); System.Console.WriteLine("Press any key to exit."); System.Console.Read(); }