implement feedback loop

This commit is contained in:
2026-03-07 16:15:21 +01:00
parent 5d57abe913
commit 3de787e07c
18 changed files with 170 additions and 12 deletions

View File

@@ -0,0 +1,29 @@
using AipsCore.Application.Common.Message.ErrorMessage;
using AipsRT.Hubs;
using AipsRT.Model.Whiteboard;
using Microsoft.AspNetCore.SignalR;
namespace AipsRT.Services;
public class RtErrorHandleStrategy : IErrorMessageHandleStrategy
{
private readonly IHubContext<WhiteboardHub> _hubContext;
private readonly WhiteboardManager _whiteboardManager;
public RtErrorHandleStrategy(IHubContext<WhiteboardHub> hubContext, WhiteboardManager whiteboardManager)
{
_hubContext = hubContext;
_whiteboardManager = whiteboardManager;
}
public async Task Handle(ErrorMessage message, CancellationToken cancellationToken)
{
await _whiteboardManager.RefreshWhiteboard(message.WhiteboardId);
var whiteboard = _whiteboardManager.GetWhiteboard(message.WhiteboardId)!;
await _hubContext.Clients
.Group(whiteboard.WhiteboardId.ToString())
.SendAsync("InitWhiteboard", whiteboard, cancellationToken);
}
}