Hello @J. Diego Rodríguez Royo,
You can Create and register an out-of-process background task in WinUI3, an example, Or Create and register a Win32 COM background task.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I'm developing an App that communicates with a remote server using a web socket, currently, it only opens the connection when the app is open in the foreground. I'm trying to search how can I create a background process that keeps the connection open to handle messages from the remote server.
I also would like the background process to be started at log-in, after an update, and if the process is closed, open it again when the App is open.
I've already tried to do this using exe arguments that avoids opening the whole app and it only opens the connection and then I set the thread to sleep indefinitely with Thread.Sleep(Timeout.Infinite). It works, but I don't know how can it be opened in the different cases I mentioned above. I've been thinking to use windows.startupTask extension, but I don't find a way to configure two of them (One should be for the app and the other for the background process and should be managed independently, so that the user can allow to open the background process at log-in, but not the App).
I also tried to open the background process from the App with FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync("Arg1 Arg2") when RuntimeHelper.IsMSIX is set to true but although the method is called, nothing happens.
Maybe there are better approaches than the mentioned way, maybe ComServers... I don't know, I'm pretty new on background process in Windows App SDK.
Hello @J. Diego Rodríguez Royo,
You can Create and register an out-of-process background task in WinUI3, an example, Or Create and register a Win32 COM background task.