AyCode.Core/AyCode.Services/SignalRs
Loretta 9150df6982 Improve binary/SignalR docs, add protocol and writer deep-dives
Major documentation overhaul for binary serialization and SignalR:
- Simplified and clarified AyCode.Core README, with direct links to new deep-dive docs (BINARY_IMPLEMENTATION.md, BINARY_WRITERS.md)
- Added BINARY_WRITERS.md: detailed design and rationale for ArrayBinaryOutput and BufferWriterBinaryOutput, chunk sizing, and buffer management
- Refined BINARY_IMPLEMENTATION.md: clearer buffer management, output strategies, and hot-path rules; references new writers doc
- Added SIGNALR_BINARY_PROTOCOL.md: full wire format, zero-copy pipeline, dual BWO pattern, and read path for custom SignalR protocol
- Updated SignalRs README and SIGNALR.md: clarified protocol, tag system, request/response flow, and technical debt
- Improved cross-linking and discoverability throughout

These changes make the technical documentation clearer, more maintainable, and easier to navigate for advanced contributors.
2026-04-04 09:27:36 +02:00
..
AcBinaryHubProtocol.cs SignalR: Add streaming & zero-copy binary protocol 2026-04-04 00:47:48 +02:00
AcSignalRClientBase.cs SignalR: Add streaming & zero-copy binary protocol 2026-04-04 00:47:48 +02:00
AcSignalRTags.cs Refactor JSON/SignalR infra; add full test & benchmark suite 2025-12-11 21:25:50 +01:00
IAcSignalRHubBase.cs SignalR: Add streaming & zero-copy binary protocol 2026-04-04 00:47:48 +02:00
IAcSignalRHubClient.cs Switch to binary serialization; add IEntityComment interface 2026-03-06 14:51:06 +01:00
README.md Improve binary/SignalR docs, add protocol and writer deep-dives 2026-04-04 09:27:36 +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 serializer options, string fast paths & analysis 2026-01-25 16:40:40 +01: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, byte[] messageBytes, int? requestId).

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.