AyCode.Core/AyCode.Services.Server/SignalRs/README.md

1.8 KiB

SignalRs

Server-side SignalR hub infrastructure: hub base class, session management, data source with change tracking, and client broadcast service.

Key Files

Hub

  • AcWebSignalRHubBase.cs — Abstract hub extending Hub<IAcSignalRHubItemServer>. Manages connection lifecycle, message dispatch via DynamicMethodRegistry, binary/JSON parameter deserialization. Response methods: ResponseToCaller(), SendMessageToOthers(), SendMessageToUserIdInternal().
  • IAcSignalRHubItemServer.cs — Server hub interfaces: IAcSignalRHubItemServer, IAcSignalRHubServer.
  • AcLoggerSignalRHub.cs — Specialized hub for receiving log items via SignalR (AddLogItem()).

Session & Broadcast

  • AcSessionService.cs — Generic session manager with ConcurrentDictionary<TSessionItemId, TSessionItem>.
  • IAcSessionItem.cs — Session item interface with SessionId property.
  • AcSignalRSendToClientService.cs — Abstract broadcast service: SendMessageToClient(), SendMessageToAllClients(), SendMessageToConnection(), SendMessageToUser().

Data Source

  • AcSignalRDataSource.cs — Server-side data source implementing IList<T> with change tracking (TrackingItem<T, TId>, ChangeTracking<T, TId>). Supports LoadDataSource(), LoadDataSourceFromResponseData() with binary/JSON deserialization.

Utilities

  • ExtensionMethods.csInvokeMethod() — invokes methods and unwraps Task/Task<T>/ValueTask results.
  • TrackingItemHelpers.cs — Deep clone helpers: JsonClone<T>(), ReflectionClone<T>().

LLM Maintenance: If you modify code in this folder, update this README to reflect the changes. If you notice the README content does not match the current code, automatically update the README to match the code.