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

27 lines
1.7 KiB
Markdown

# SignalRs
Server-side SignalR hub infrastructure: hub base class, session management, and client broadcast service.
> **Architecture:** For full dispatch flow, tag system, and tech debt documentation see `AyCode.Services/docs/SIGNALR/README.md`.
## 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
> **Relocated (LLMP-DEC-68):** `AcSignalRDataSource` — the client-side real-time collection — moved to `AyCode.Services/SignalRs/` and is **no longer part of this server-side assembly**. Full spec: `AyCode.Services/docs/SIGNALR_DATASOURCE/README.md`.
### Utilities
- **`ExtensionMethods.cs`** — `InvokeMethod()` — invokes methods and unwraps `Task`/`Task<T>`/`ValueTask` results.
> `TrackingItemHelpers.cs` (deep-clone helpers used by the data source) relocated to `AyCode.Services/SignalRs/` alongside `AcSignalRDataSource` — see LLMP-DEC-68.