using AyCode.Services.SignalRs; using Microsoft.AspNetCore.SignalR; using Microsoft.AspNetCore.SignalR.Protocol; using Microsoft.Extensions.DependencyInjection; namespace AyCode.Services.Server.SignalRs; /// /// Server-side registration extension for the ("acbinary"). /// Mirrors the ASP.NET Core idiomatic AddJsonProtocol(...) / AddMessagePackProtocol(...). /// /// Kept separate from the client-side extension (in AyCode.Services) so that pure client /// projects (MAUI, WASM) do not pull in the server SignalR assembly /// (Microsoft.AspNetCore.SignalR.Core) through a transitive reference. /// /// public static class AcSignalRServerProtocolExtensions { /// /// Registers (name: "acbinary") as a SignalR hub /// protocol on the server. Options can be configured via either: /// /// services.Configure<AcBinaryHubProtocolOptions>(...) — DI-level defaults /// The optional callback — overrides DI values inline /// /// public static ISignalRServerBuilder AddAcBinaryProtocol(this ISignalRServerBuilder builder, Action? configure = null) { builder.Services.AddSingleton(sp => AcSignalRProtocolExtensions.BuildProtocol(sp, configure)); return builder; } }