MapHub TransportSendTimeout, WebSockets.CloseTimeout fix

This commit is contained in:
Loretta 2025-11-16 19:20:23 +01:00
parent 0dafd6c5c4
commit 02f7c768cb
1 changed files with 17 additions and 7 deletions

View File

@ -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<OrderDtoDbTable>();
services.AddScoped<OrderItemDtoDbTable>();
services.AddScoped<OrderItemPalletDbTable>();
services.AddScoped<PartnerDbTable>();
services.AddScoped<ShippingDbTable>();
services.AddScoped<ShippingDocumentDbTable>();
@ -71,15 +72,15 @@ public class PluginNopStartup : INopStartup
services.AddScoped<ShippingItemPalletDbTable>();
services.AddScoped<FilesDbTable>();
services.AddScoped<ShippingDocumentToFilesDbTable>();
services.AddScoped<StockQuantityHistoryDtoDbTable>();
services.AddScoped<FruitBankDbContext>();
services.AddScoped<SignalRSendToClientService>();
services.AddScoped<IFruitBankDataControllerServer, FruitBankDataController>();
services.AddScoped<ICustomOrderSignalREndpointServer, CustomOrderSignalREndpoint>();
//services.AddScoped<CustomModelFactory, ICustomerModelFactory>();
services.AddScoped<IPriceCalculationService, CustomPriceCalculationService>();
services.AddScoped<PriceCalculationService, CustomPriceCalculationService>();
@ -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<DevAdminSignalRHub>(fruitBankHubEndPoint);
endpoints.MapHub<DevAdminSignalRHub>(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}";