// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public async void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseMetricServer(); app.UseWebSockets(new WebSocketOptions { KeepAliveInterval = TimeSpan.FromSeconds(120), ReceiveBufferSize = 4 * 1024 }); app.Use(async(context, next) => { if (context.Request.Path == "/ws") { if (context.WebSockets.IsWebSocketRequest) { var webSocket = await context.WebSockets.AcceptWebSocketAsync(); await new MessageHandler().Handle(context, webSocket); } else { context.Response.StatusCode = 400; } } else { await next(); } }); var client = env.IsDevelopment() ? new EtcdClient("http://localhost") : new EtcdClient("http://etcd"); var me = Guid.NewGuid().ToString(); var brokerTable = new BrokerTable(client); await brokerTable.ImHere(); var topicList = new TopicList(client, me); await topicList.SetupTopicListWatch(); }