AyCode.Core/AyCode.Services/SignalRs
Loretta 2c1440d42b Add env infra (IsProdDb), ADRs for env & server filtering
Introduced AcEnv.IsProdDb with hydration and change events for framework-level environment tracking. Added ADR 0002 (environment infra migration) and ADR 0004 (SignalR DataSource server-side filtering via CriteriaOperator). Updated docs and TODOs to reflect new features and design decisions. Marked ADR 0003 as accepted and extended DataSource documentation.
2026-07-15 10:16:00 +02:00
..
AcBinaryDeserExecutor.cs Relocate AcSignalRDataSource to AyCode.Services 2026-06-08 10:43:10 +02:00
AcBinaryHubProtocol.cs Add EKÁER test creds doc, SignalR connect hook 2026-07-13 18:59:47 +02:00
AcBinaryHubProtocolOptions.cs [LOADED_DOCS: 3 files, no new loads] 2026-05-03 15:21:15 +02:00
AcHubConnectionOptions.cs [LOADED_DOCS: .github\copilot-instructions.md] 2026-04-22 22:44:37 +02:00
AcSignalRClientBase.cs Add EKÁER test creds doc, SignalR connect hook 2026-07-13 18:59:47 +02:00
AcSignalRConnectionExtensions.cs Framework-first doctrine, DI logger factory, config refactor 2026-04-23 16:11:22 +02:00
AcSignalRDataSource.cs Add EKÁER history grid, detail view, and entity support 2026-06-10 16:24:53 +02:00
AcSignalRProtocolExtensions.cs Framework-first doctrine, DI logger factory, config refactor 2026-04-23 16:11:22 +02:00
AcSignalRTags.cs Ekaer validation tightened, SignalR tags, doc updates 2026-07-10 15:36:58 +02:00
AyCodeBinaryHubProtocol.cs Fix SignalR binary protocol: VarUInt framing & type-safe ser 2026-05-27 05:47:23 +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 Improve SignalR client deserialization and docs 2026-06-07 07:19:47 +02:00
ISignalParams.cs Refactor: use byte[]-output AcBinarySerializer overloads 2026-05-27 12:30:07 +02:00
README.md Add env infra (IsProdDb), ADRs for env & server filtering 2026-07-15 10:16:00 +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: use byte[]-output AcBinarySerializer overloads 2026-05-27 12:30:07 +02:00
TrackingItemHelpers.cs Relocate AcSignalRDataSource to AyCode.Services 2026-06-08 10:43:10 +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/README.md. Binary protocol: For wire format, zero-copy pipeline, and three-path read logic see AyCode.Services/docs/SIGNALR_BINARY_PROTOCOL/README.md. Known issues: AyCode.Services/docs/SIGNALR/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>() safe is T cast — type-mismatch returns null, does not throw). 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; grid-layout roaming tags GetGridLayoutTag / SaveGridLayoutTag / DeleteGridLayoutTag (90010-12) — key-value layout storage contract (key, [layoutJson,] userId), implemented by consumer hubs.
  • SignalRCrudTags.cs — Sealed class bundling 5 independent CRUD tag integers. GetMessageTagByTrackingState() maps TrackingState -> tag. See AyCode.Services/docs/SIGNALR_DATASOURCE/README.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.

Data Source

Full specification: AyCode.Services/docs/SIGNALR_DATASOURCE/README.md

  • AcSignalRDataSource.cs — Abstract generic real-time collection (AcSignalRDataSource<TDataItem, TId, TIList>) implementing IList<T>, IList, IReadOnlyList<T>. Consumer of the transport above (not part of it) — wraps CRUD-tag communication behind a regular list. Transport-agnostic by design; the current implementation is SignalR-coupled.
    • Change tracking: TrackingItem<T, TId> wraps each modified item with TrackingState + OriginalValue (rollback snapshot). ChangeTracking<T, TId> manages the tracked list.
    • Loading: LoadDataSource() (sync-wait), LoadDataSourceAsync() (async callback), LoadItem(id) (single). Raw-byte[] path uses AcBinaryDeserializer.PopulateMerge into IAcObservableCollection (batch UI notification via BeginUpdate/EndUpdate); SerializerType selects Binary vs JSON+GZip.
    • Saving: SaveChanges() / SaveChangesAsync() iterate tracked items, post each via the state's CRUD tag, roll back on failure; SaveItem() for individual saves. IsSyncing + OnSyncingStateChanged expose sync state.
  • TrackingItemHelpers.csJsonClone / ReflectionClone deep-clone helpers producing the OriginalValue rollback snapshots.