Merge fix: Fix for #664, open for comment #644

This commit is contained in:
Gregor Biswanger
2022-04-06 19:17:43 +02:00
5 changed files with 310 additions and 185 deletions

View File

@@ -2,6 +2,7 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Quobject.SocketIoClientDotNet.Client;
namespace ElectronNET.API
{
@@ -12,10 +13,14 @@ namespace ElectronNET.API
{
public LifetimeServiceHost(IHostApplicationLifetime lifetime)
{
lifetime.ApplicationStarted.Register(() =>
lifetime.ApplicationStarted.Register(async () =>
{
App.Instance.IsReady = true;
// wait till the socket is open before setting app to ready
while(BridgeConnector.Socket.Io().ReadyState != Manager.ReadyStateEnum.OPEN) {
await Task.Delay(50).ConfigureAwait(false);
}
App.Instance.IsReady = true;
Console.WriteLine("ASP.NET Core host has fully started.");
});
}