Repair and add SignalR

master
Jan Beníček 2024-01-16 12:52:40 +01:00
parent 6dc7a1674d
commit ad6beb6366
2 changed files with 7 additions and 7 deletions

View File

@ -20,14 +20,14 @@ namespace API_SequentMicrosystems.Hubs
await Clients.All.SendAsync("SyncRequested", clientID); await Clients.All.SendAsync("SyncRequested", clientID);
} }
public async Task SyncPoints(string clientID, object o) public async Task SyncPoints(string clientID, string data)
{ {
await Clients.All.SendAsync("SyncPointsData", clientID, o); await Clients.All.SendAsync("SyncPointsData", clientID, data);
} }
public async Task SyncRTD8TMChart(string clientID, object o) public async Task SyncRTD8TMChart(string clientID, string data)
{ {
await Clients.All.SendAsync("SyncRTD8TMChartData", clientID, o); await Clients.All.SendAsync("SyncRTD8TMChartData", clientID, data);
} }

View File

@ -2,8 +2,6 @@ using API_SequentMicrosystems.Hubs;
using API_SequentMicrosystems.Services; using API_SequentMicrosystems.Services;
using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models;
using System.Reflection; using System.Reflection;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace API_SequentMicrosystems namespace API_SequentMicrosystems
{ {
@ -17,6 +15,7 @@ namespace API_SequentMicrosystems
builder.Services.AddControllers().AddNewtonsoftJson(); builder.Services.AddControllers().AddNewtonsoftJson();
builder.Services.AddSignalR(); builder.Services.AddSignalR();
builder.Services.AddSignalRCore();
builder.Services.AddSingleton<RTDDAService>(); builder.Services.AddSingleton<RTDDAService>();
builder.Services.AddSingleton<PointsService>(); builder.Services.AddSingleton<PointsService>();
@ -63,7 +62,8 @@ namespace API_SequentMicrosystems
app.Services.GetService<RTDDAService>(); app.Services.GetService<RTDDAService>();
app.Services.GetService<PointsService>(); app.Services.GetService<PointsService>();
app.MapHub<SyncHub>("/signalr/sync"); app.MapHub<SyncHub>("/signalr");
app.UseWebSockets();
app.MapControllers(); app.MapControllers();