// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { app.UseDefaultFiles(); var provider = new FileExtensionContentTypeProvider(); // Add new mappings provider.Mappings[".mtl"] = "text/plain"; provider.Mappings[".obj"] = "text/plain"; app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = provider }); app.UseWebSockets(); app.Use(async(context, next) => { if (context.Request.Path == "/connect_client") { if (context.WebSockets.IsWebSocketRequest) { WebSocket webSocket = await context.WebSockets.AcceptWebSocketAsync(); ClientView cs = new ClientView(webSocket); simulationController.AddView(cs); await cs.StartReceiving(); simulationController.RemoveView(cs); } else { context.Response.StatusCode = 400; } } else { await next(); } //if statement for restarting the game after winning if (context.Request.Path == "/restart") { simulationController.SetWorld(new Models.World()); } }); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { //app.UseHsts(); } //app.UseHttpsRedirection(); //app.UseMvc(); //app.UseDirectoryBrowser(new DirectoryBrowserOptions()); }