AyCode.Core/AyCode.Services/SignalRs
Loretta 3b7007002a Refactor SignalR param handling: SignalParams replaces old
Major protocol/API change: replace SignalReceiveParams with SignalParams everywhere. SignalParams now carries packed method parameters as a single byte[] and provides SetParameterValues/GetParameterValues for type-safe packing/unpacking. All hub/client interfaces, method signatures, and dispatch logic updated. Legacy parameter serialization helpers removed; all parameter logic is encapsulated in SignalParams. Documentation and tests updated to reflect new wire format and flow. This unifies parameter handling, clarifies the protocol, and enables robust, extensible type-guided serialization. Breaking change.
2026-04-06 08:49:12 +02:00
..
AcBinaryHubProtocol.cs Refactor SignalR: separate metadata and payload transport 2026-04-05 09:30:54 +02:00
AcSignalRClientBase.cs Refactor SignalR param handling: SignalParams replaces old 2026-04-06 08:49:12 +02:00
AcSignalRTags.cs Refactor JSON/SignalR infra; add full test & benchmark suite 2025-12-11 21:25:50 +01:00
IAcSignalRHubBase.cs Refactor SignalR param handling: SignalParams replaces old 2026-04-06 08:49:12 +02:00
IAcSignalRHubClient.cs Refactor SignalR param handling: SignalParams replaces old 2026-04-06 08:49:12 +02:00
ISignalParams.cs Refactor SignalR param handling: SignalParams replaces old 2026-04-06 08:49:12 +02:00
README.md Refactor SignalR param handling: SignalParams replaces old 2026-04-06 08:49:12 +02:00
SendToClientType.cs SignalR improvements; 2025-10-30 14:55:47 +01:00
SignalMessageTagAttribute.cs SignalR improvements; 2025-10-30 14:55:47 +01:00
SignalRCrudTags.cs improvements, fixes 2024-06-09 11:13:23 +02:00
SignalRRequestModel.cs Fix binary deserializer string interning and add regressions 2025-12-13 00:12:21 +01:00
SignalRSerializationHelper.cs Refactor SignalR param handling: SignalParams replaces old 2026-04-06 08:49:12 +02:00

README.md

SignalRs

Custom binary SignalR protocol, client infrastructure, message tagging, and serialization helpers.

Architecture: For full dispatch flow, tag system, and tech debt documentation see AyCode.Services/docs/SIGNALR.md. Binary protocol: For wire format, zero-copy pipeline, and dual BWO pattern see AyCode.Services/docs/SIGNALR_BINARY_PROTOCOL.md.

Key Files

Protocol

  • AcBinaryHubProtocol.cs — Custom IHubProtocol replacing JSON+Base64 with AcBinarySerializer. Handles all 9 SignalR message types (Invocation, StreamItem, Completion, Ping, Close, etc.). Uses BufferWriterBinaryOutput standalone mode for zero-copy writes to the SignalR pipe. byte[] fast-path bypasses the serializer entirely. Inner SpanReader ref struct for zero-alloc parsing.

Client

  • AcSignalRClientBase.cs — Abstract SignalR client managing HubConnection, request/response tracking via pooled SignalRRequestModel. Methods: SendMessageToServerAsync<TResponse>(), CRUD helpers (Post, Get, GetAll, GetAllInto). Configurable timeouts.
  • IAcSignalRHubClient.cs — Client interface + SignalResponseDataMessage (sealed, supports JSON/Binary with GZip, caching, diagnostics).
  • IAcSignalRHubBase.cs — Base hub interface: OnReceiveMessage(int messageTag, int? requestId, SignalParams signalParams, byte[] data).
  • ISignalParams.csISignalParams base interface + SignalParams (Status, DataSerializerType, Parameters byte[][]?). Metadata travels as separate hub argument (AcBinary serialized), payload byte[] uses protocol fast-path (zero-copy). Parameters and data are independent — both nullable in any direction.

Message Tagging

  • SignalMessageTagAttribute.cs — Three attributes: TagAttribute (base, int messageTag), SignalRAttribute (server method routing + client notification), SignalRSendToClientAttribute (client-side receive).
  • AcSignalRTags.cs — Static constants: None, PingTag, EchoTag.
  • SignalRCrudTags.cs — Sealed class bundling 5 independent CRUD tag integers. GetMessageTagByTrackingState() maps TrackingState -> tag. See AyCode.Services.Server/docs/SIGNALR_DATASOURCE.md.
  • SendToClientType.cs — Enum: None, Others, Caller, All.

Serialization & Pooling

  • SignalRSerializationHelper.cs — Static helpers: SerializeToBinary(), DeserializeFromBinary(), compressed JSON variants, CreateResponseData().
  • SignalRRequestModel.cs — Poolable (IResettable) request tracking model with ObjectPool for reuse.