AyCode.Core/AyCode.Services/SignalRs
Loretta c6e1fa8efc Refactor: centralize SignalR protocol config/options
- Added AcBinaryHubProtocolOptions for unified protocol configuration (serializer, mode, buffer size, flush strategy, timeout, name, logger) with validation and DI support.
- Refactored AcBinaryHubProtocol and AyCodeBinaryHubProtocol to use options object; legacy constructors now delegate to options-based API.
- Added per-chunk flush timeout to AsyncPipeWriterOutput and AcBinarySerializer; throws TimeoutException on slow consumers.
- Improved XML docs and comments for pipeline/backpressure/timeout clarity.
- Updated SIGNALR_BINARY_PROTOCOL.md to document new options and AsyncSegment platform rules.
2026-04-20 17:44:37 +02:00
..
AcBinaryHubProtocol.cs Refactor: centralize SignalR protocol config/options 2026-04-20 17:44:37 +02:00
AcBinaryHubProtocolOptions.cs Refactor: centralize SignalR protocol config/options 2026-04-20 17:44:37 +02:00
AcSignalRClientBase.cs [LOADED_DOCS: NONE] 2026-04-20 07:10:03 +02:00
AcSignalRTags.cs Refactor JSON/SignalR infra; add full test & benchmark suite 2025-12-11 21:25:50 +01:00
AyCodeBinaryHubProtocol.cs Refactor: centralize SignalR protocol config/options 2026-04-20 17:44:37 +02:00
BinaryProtocolMode.cs Chunked framing for AsyncSegment: zero-copy SignalR ser/deser 2026-04-11 10:35:03 +02:00
IAcSignalRHubBase.cs Zero-copy SignalR: direct object response, no SignalData 2026-04-06 22:45:00 +02:00
IAcSignalRHubClient.cs Zero-copy SignalR: direct object response, no SignalData 2026-04-06 22:45:00 +02:00
ISignalParams.cs [LOADED_DOCS: .github\copilot-instructions.md] 2026-04-19 12:58:31 +02:00
README.md Refactor SequenceBinaryInput: zero-copy, docs, issues 2026-04-07 10:33:38 +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 Zero-copy SignalR: direct object response, no SignalData 2026-04-06 22:45:00 +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 three-path read logic see AyCode.Services/docs/SIGNALR_BINARY_PROTOCOL.md. Known issues: AyCode.Services/docs/SIGNALR_ISSUES.md

Key Files

Protocol

  • AcBinaryHubProtocol.cs — Unsealed base IHubProtocol replacing JSON+Base64 with AcBinarySerializer. Handles all 9 SignalR message types. Write: BufferWriterBinaryOutput standalone + AcBinarySerializer.Serialize(value, output) zero-copy to pipe. byte[] fast-path writes tag+VarUInt+bytes via BWO. Read: SequenceReader<byte> from pipe's ReadOnlySequence. Three-path ReadSingleArgument: byte[] fast-path (0x44 tag), IsRawBytesData (raw byte[]), typed deser via SignalDataType. _currentSignalParams captures arg[2] for type-aware arg[3] deserialization.
  • AyCodeBinaryHubProtocol.cs — Derived protocol (currently empty). Exists for registration and future project-specific hooks. Register this instead of AcBinaryHubProtocol.

Client

  • AcSignalRClientBase.cs — Abstract SignalR client managing HubConnection, request/response tracking via pooled SignalRRequestModel. SendCoreAsync builds SignalParams (with IsRawBytesData when T == byte[]). CRUD helpers (Post, Get, GetAll, GetAllInto). Configurable timeouts.
  • IAcSignalRHubClient.cs — Client interface + SignalResponseDataMessage (sealed, RawResponseData is object? — typed object or byte[], GetResponseData<T>() direct cast). Legacy message types (IdMessage, SignalPostJsonDataMessage) marked [Obsolete].
  • IAcSignalRHubBase.cs — Base hub interface: OnReceiveMessage(int messageTag, int? requestId, SignalParams signalParams, object data).
  • ISignalParams.csISignalParams base interface + SignalParams (Status, DataSerializerType, Parameters byte[]?, SignalDataType string?, IsRawBytesData bool). Metadata travels as separate hub argument (AcBinary serialized). 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.
  • SignalRRequestModel.cs — Poolable (IResettable) request tracking model with ObjectPool for reuse.