mirror of
https://github.com/ckaczor/HomeMonitor.git
synced 2026-01-13 17:22:54 -05:00
Add power hub
This commit is contained in:
19
Hub/Service/Hubs/PowerHub.cs
Normal file
19
Hub/Service/Hubs/PowerHub.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using JetBrains.Annotations;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ChrisKaczor.HomeMonitor.Hub.Service.Hubs
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class PowerHub : Microsoft.AspNetCore.SignalR.Hub
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public async Task SendLatestSample(string message)
|
||||
{
|
||||
Console.WriteLine(message);
|
||||
|
||||
await Clients.Others.SendAsync("LatestSample", message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,7 @@ namespace ChrisKaczor.HomeMonitor.Hub.Service
|
||||
applicationBuilder.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapHub<WeatherHub>("/weather");
|
||||
endpoints.MapHub<PowerHub>("/power");
|
||||
endpoints.MapDefaultControllerRoute();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user