26 lines
1.9 KiB
Markdown
26 lines
1.9 KiB
Markdown
# SignalRs
|
|
|
|
Custom binary SignalR protocol, client infrastructure, message tagging, and serialization helpers.
|
|
|
|
> **Architecture:** For full dispatch flow, tag system, and tech debt documentation see [`docs/SIGNALR_ARCHITECTURE.md`](../../docs/SIGNALR_ARCHITECTURE.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.). 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 record mapping 5 CRUD tags. `GetMessageTagByTrackingState()` maps `TrackingState` → tag.
|
|
- **`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.
|