Replaces legacy JSON-in-Binary parameter envelopes with a length-prefixed, per-parameter binary format for all client→server calls. Introduces SerializeParametersToBinary and DeserializeParametersFromBinary for type-safe, zero-copy parameter handling. Marks IdMessage, SignalPostJsonDataMessage, and related wrappers as obsolete. Updates all client CRUD/messaging helpers and server-side dispatch to use object[] binary serialization. Adds DataSerializerType to SignalReceiveParams for response format indication. Updates tests and documentation to reflect new protocol. BREAKING CHANGE: not compatible with previous JSON-in-Binary clients/servers. |
||
|---|---|---|
| .. | ||
| AcBinaryHubProtocol.cs | ||
| AcSignalRClientBase.cs | ||
| AcSignalRTags.cs | ||
| IAcSignalRHubBase.cs | ||
| IAcSignalRHubClient.cs | ||
| ISignalParams.cs | ||
| README.md | ||
| SendToClientType.cs | ||
| SignalMessageTagAttribute.cs | ||
| SignalRCrudTags.cs | ||
| SignalRRequestModel.cs | ||
| SignalRSerializationHelper.cs | ||
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 seeAyCode.Services/docs/SIGNALR_BINARY_PROTOCOL.md.
Key Files
Protocol
AcBinaryHubProtocol.cs— CustomIHubProtocolreplacing JSON+Base64 withAcBinarySerializer. Handles all 9 SignalR message types (Invocation, StreamItem, Completion, Ping, Close, etc.). UsesBufferWriterBinaryOutputstandalone mode for zero-copy writes to the SignalR pipe.byte[]fast-path bypasses the serializer entirely. InnerSpanReaderref struct for zero-alloc parsing.
Client
AcSignalRClientBase.cs— Abstract SignalR client managingHubConnection, request/response tracking via pooledSignalRRequestModel. 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, SignalReceiveParams receiveParams, byte[] data).ISignalParams.cs—ISignalParamsbase interface +SignalReceiveParams(Status). Metadata travels as separate hub argument (AcBinary serialized), payloadbyte[]uses protocol fast-path (zero-copy).
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()mapsTrackingState→ tag. SeeAyCode.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 withObjectPoolfor reuse.