private void LoopTask(object o) { Task.Run(async() => { var info = await ServerRuntimeRepostory.GetHomeInfo(); _ = HubContext.Clients.All.SendAsync("serverruntimeinfo", info); }); }
public LinuxRuntimeService(ServerRuntimeRepostory serverRuntimeRepostory) { ServerRuntimeRepostory = serverRuntimeRepostory; CollectionTimer = new Timer(LoopTask, null, 0, (int)TimeSpan.FromSeconds(1).TotalMilliseconds); }
public ServerPublisher(ServerRuntimeRepostory serverRuntimeRepostory, IHubContext <ServerPublishHub> hubContext) { ServerRuntimeRepostory = serverRuntimeRepostory; HubContext = hubContext; CollectionTimer = new Timer(LoopTask, null, 0, (int)TimeSpan.FromSeconds(1).TotalMilliseconds); }