From 4bbd55f6773d61ced5f7c28842d4fe175bbc0035 Mon Sep 17 00:00:00 2001 From: yanghongwei Date: Thu, 10 Apr 2025 12:26:25 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=86=E8=8A=82=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Program.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Program.cs b/Program.cs index 1953808..3bc9740 100644 --- a/Program.cs +++ b/Program.cs @@ -11,6 +11,8 @@ using LY.App.Model; using LY.App.MiddleWare; using LY.App.Common.WebSocket; using Microsoft.Extensions.FileProviders; +using Microsoft.AspNetCore.Http.Connections; +using Microsoft.Extensions.Options; var builder = WebApplication.CreateBuilder(args); @@ -127,7 +129,12 @@ app.UseMiddleware(); //Ö´ÐÐÆ¥ÅäµÄ¶Ëµã app.UseEndpoints(endpoints => { - endpoints.MapHub("/websocket"); + endpoints.MapHub("/websocket", options => + { + options.Transports = + HttpTransportType.WebSockets | + HttpTransportType.LongPolling; + }); endpoints.MapControllers(); });