Fix models in environment service and add more SignalR messaging

This commit is contained in:
2024-03-04 16:32:33 -05:00
parent a8e60c2e87
commit 2ef541d72f
7 changed files with 96 additions and 7 deletions

View File

@@ -9,7 +9,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/net5.0/ChrisKaczor.HomeMonitor.Hub.Service.dll",
"program": "${workspaceFolder}/bin/Debug/net8.0/ChrisKaczor.HomeMonitor.Hub.Service.dll",
"args": [],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,

View File

@@ -9,11 +9,19 @@ namespace ChrisKaczor.HomeMonitor.Hub.Service.Hubs
public class EnvironmentHub(ILogger<EnvironmentHub> logger) : Microsoft.AspNetCore.SignalR.Hub
{
[UsedImplicitly]
public async Task SendMessage(string message)
public async Task SendLatest(string message)
{
logger.LogInformation(message);
await Clients.Others.SendAsync("Message", message);
await Clients.Others.SendAsync("Latest", message);
}
[UsedImplicitly]
public async Task RequestLatest()
{
logger.LogInformation("RequestLatest");
await Clients.Others.SendAsync("RequestLatest");
}
}
}