Add AcBinaryHubProtocol to SignalR for binary transport

Registered custom AcBinaryHubProtocol as a singleton IHubProtocol
in PluginNopStartup.cs to enable efficient binary messaging
(via AcBinarySerializer) and eliminate JSON/Base64 overhead.
Updated SIGNALR_ENDPOINTS.md to document the new protocol,
noting WebSocket (TransferFormat.Binary) requirement and
affected hubs (DevAdminSignalRHub, LoggerSignalRHub).
Explicitly set StatefulReconnectBufferSize to 30 MB in both
code and documentation.
This commit is contained in:
Loretta 2026-04-04 23:22:53 +02:00
parent 6c776a97ca
commit d68f060e66
2 changed files with 8 additions and 0 deletions

View File

@ -1,6 +1,7 @@
//using AyCode.Core.Loggers;
using AyCode.Core.Loggers;
using AyCode.Services.SignalRs;
using DevExpress.AspNetCore;
using FruitBank.Common;
using FruitBank.Common.Interfaces;
@ -13,6 +14,7 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http.Connections;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.SignalR;
using Microsoft.AspNetCore.SignalR.Protocol;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Nop.Core.Domain.Orders;
@ -149,6 +151,8 @@ public class PluginNopStartup : INopStartup
hubOptions.StatefulReconnectBufferSize = 30_000_000; //30MB; //default: 100,000 bytes;
//hubOptions.HandshakeTimeout = TimeSpan.FromSeconds(15); //default timeout is 15 seconds
});
services.AddSingleton<IHubProtocol>(new AcBinaryHubProtocol());
}
/// <summary>

View File

@ -16,6 +16,10 @@ Configured in `PluginNopStartup`:
| ClientTimeoutInterval | 30 seconds |
| MaximumReceiveMessageSize | 30 MB |
| EnableDetailedErrors | true |
| StatefulReconnectBufferSize | 30 MB |
| **HubProtocol** | **`AcBinaryHubProtocol`** (singleton `IHubProtocol`) |
**Wire protocol:** `AcBinaryHubProtocol` (`AyCode.Services.SignalRs`, from `AyCode.Services.dll`) — custom binary `IHubProtocol` using `AcBinarySerializer`. Eliminates JSON+Base64 overhead. Requires `TransferFormat.Binary` → WebSocket transport only. Protocol name: `"acbinary"`. Registered as `services.AddSingleton<IHubProtocol>(new AcBinaryHubProtocol())` after `AddSignalR()`.
Hubs registered: `DevAdminSignalRHub`, `LoggerSignalRHub` (from AyCode.Core.Server).