Implemented power state and task streaming over signalr

This commit is contained in:
2024-12-30 01:16:23 +01:00
parent 394d8b05ed
commit 0bd9074494
14 changed files with 436 additions and 4 deletions

View File

@@ -15,6 +15,7 @@ public class Server
public StateMachine<ServerState> StateMachine { get; set; }
public ServerConfiguration Configuration { get; set; }
public string? ContainerId { get; set; }
public event Func<string, Task> OnTaskAdded;
// This can be used to stop streaming when the server gets destroyed or something
public CancellationTokenSource Cancellation { get; set; }
@@ -59,4 +60,16 @@ public class Server
}
#endregion
#region Event invokers
public async Task InvokeTaskAdded(string task)
{
if(OnTaskAdded == null)
return;
await OnTaskAdded.Invoke(task).ConfigureAwait(ConfigureAwaitOptions.SuppressThrowing);
}
#endregion
}