Implemented power state and task streaming over signalr
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user