public static void Configuration(IAppBuilder app) { var container = DependencyConfiguration.Configure(app); SignalRConfiguration.Configure(app, container); MvcConfiguration.Configure(app, container); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { LoggingConfiguration.ConfigureLogging(app, env, loggerFactory, Configuration); app.UseAuthentication(); SwaggerConfiguration.AddSwagger(app); CorsConfiguration.UseCors(app); if (!env.IsDevelopment()) { var context = app.ApplicationServices.GetService <PgsKanbanContext>(); context.Database.Migrate(); } SignalRConfiguration.UseSignalR(app); app.UseMvc(); }
// This method gets called by the runtime. Use this method to add services to the container. public IServiceProvider ConfigureServices(IServiceCollection services) { services.AddMemoryCache(); services.AddDbContext <PgsKanbanContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); IdentityConfiguration.AddIdentity(services); SwaggerConfiguration.ConfigureSwagger(services); SignalRConfiguration.AddSignalR(services); MvcConfiguration.AddMvc(services); IdentityConfiguration.ConfigureIdentity(services); CorsConfiguration.AddCors(services); OptionsRegistration.Configure(Configuration, services); services.AddSingleton <IMapper>(sp => AutoMapperConfig.Initialize()); JwtConfiguration.AddJwtAuthorization(Configuration, services); return(DependencyRegistration.Register(Configuration, services)); }
public async Task HubGroupBroadcasts_SendsMessageToGroup() { var config = new SignalRConfiguration() { AccessKey = "0123456789001234567890123456789012345678901234567890123456789", Hub = "testhub", ServiceName = "unittesthub" }; var attr = new SignalRAttribute() { }; var target = new SignalRAsyncCollector(config, attr, httpClientFactory.Object); await target.AddAsync(new SignalRMessage() { Target = "broadcastMessage", Arguments = new object[] { "say hello", 2 }, Groups = new string[] { "testGroup" } }); await target.FlushAsync(); httpClientFactory.VerifyAll(); Assert.NotNull(this.httpRequestMessage); Assert.NotNull(this.httpRequestMessage.Headers.Authorization); Assert.Equal("https://unittesthub.service.signalr.net:5002/api/v1-preview/hub/testhub/group/testGroup", this.httpRequestMessage.RequestUri.ToString()); Assert.Equal(HttpMethod.Post, this.httpRequestMessage.Method); Assert.NotNull(this.httpRequestMessage.Content); Assert.IsType <StringContent>(this.httpRequestMessage.Content); var stringContent = (StringContent)this.httpRequestMessage.Content; var payload = JsonConvert.DeserializeObject <SignalRRestAPIMessage>(await stringContent.ReadAsStringAsync()); Assert.NotNull(payload); Assert.Equal("broadcastMessage", payload.Target); Assert.Equal(2, payload.Arguments.Length); Assert.Equal("say hello", payload.Arguments[0]); Assert.Equal((Int64)2, (Int64)payload.Arguments[1]); }
public IWantUServer(SignalRConfiguration configuration) : base(configuration) { }