diff --git a/Nop.Plugin.Misc.AIPlugin/Infrastructure/PluginNopStartup.cs b/Nop.Plugin.Misc.AIPlugin/Infrastructure/PluginNopStartup.cs index 5f5e50c..db26285 100644 --- a/Nop.Plugin.Misc.AIPlugin/Infrastructure/PluginNopStartup.cs +++ b/Nop.Plugin.Misc.AIPlugin/Infrastructure/PluginNopStartup.cs @@ -10,6 +10,7 @@ using FruitBank.Common.Server.Services.SignalRs; using Mango.Nop.Services; using Mango.Nop.Services.Loggers; using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http.Connections; using Microsoft.AspNetCore.Mvc.Razor; using Microsoft.AspNetCore.SignalR; using Microsoft.Extensions.Configuration; @@ -63,7 +64,7 @@ public class PluginNopStartup : INopStartup services.AddScoped(); services.AddScoped(); services.AddScoped(); - + services.AddScoped(); services.AddScoped(); services.AddScoped(); @@ -71,15 +72,15 @@ public class PluginNopStartup : INopStartup services.AddScoped(); services.AddScoped(); services.AddScoped(); - + services.AddScoped(); - + services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); - + //services.AddScoped(); services.AddScoped(); services.AddScoped(); @@ -117,9 +118,12 @@ public class PluginNopStartup : INopStartup services.AddSignalR(hubOptions => { //hubOptions.EnableDetailedErrors = true; - hubOptions.MaximumReceiveMessageSize = null;// 256 * 1024; + hubOptions.MaximumReceiveMessageSize = null; // 256 * 1024; hubOptions.KeepAliveInterval = TimeSpan.FromSeconds(FruitBankConstClient.SignalRKeepAliveIntervalSecond); hubOptions.ClientTimeoutInterval = TimeSpan.FromSeconds(FruitBankConstClient.SignarlRTimeoutIntervalSecond); + //hubOptions.MaximumParallelInvocationsPerClient = 1; //default: 1; + //hubOptions.StatefulReconnectBufferSize = 1_000_000; //default: 100,000 bytes; + //hubOptions.HandshakeTimeout = TimeSpan.FromSeconds(15); //default timeout is 15 seconds }); } @@ -134,9 +138,15 @@ public class PluginNopStartup : INopStartup { app.UseEndpoints(endpoints => { - endpoints.MapHub(fruitBankHubEndPoint); + endpoints.MapHub(fruitBankHubEndPoint, options => + { + options.Transports = HttpTransportType.WebSockets;// | HttpTransportType.LongPolling; + options.WebSockets.CloseTimeout = new TimeSpan(0, 0, 10); //default: 5 sec. + //options.LongPolling.PollTimeout = new TimeSpan(0, 0, 90); //default: 90 sec. - }); + options.TransportSendTimeout = new TimeSpan(60); //default: 10 sec. + }); + }); }); var loggrHubEndPoint = $"/{FruitBankConstClient.LoggerHubName}";