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(); });