// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); // 웹소켓 미들웨어 사용 설정 및 각종 인스턴스 초기화 app.UseWebSockets(); WSConnectionManager wsManager = new WSConnectionManager(); WSChatHandler wsChat = new WSChatHandler(wsManager, app.ApplicationServices.GetService <WSChatQueue>()); app.MapWebSocketChatManager("/ws", wsChat); app.UseEndpoints(endpoints => { endpoints.MapControllers(); endpoints.MapRazorPages(); }); }
public WSHandler(WSConnectionManager wsManager) { WebSocketConnectionManager = wsManager; }
public WSChatHandler(WSConnectionManager wsManager, WSChatQueue chatQueue) : base(wsManager) { ChatQueue = chatQueue; }